Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialize the store lazily #25

Merged
merged 1 commit into from
Feb 24, 2023
Merged

initialize the store lazily #25

merged 1 commit into from
Feb 24, 2023

Conversation

marten-seemann
Copy link
Contributor

No description provided.

@marten-seemann marten-seemann merged commit c38f9ff into master Feb 24, 2023
@willscott
Copy link
Contributor

This means the first request will block instead of at process startup, right?

@MarcoPolo
Copy link

Worst case, yes. But you can still call Store.Init() in your own startup code if you want to pre-warm this.

This came about because we noticed dynamic allocations during our tests due to this library doing dynamic allocations in the background. And we couldn't really control it. It let to some surprising behavior to say the least. See libp2p/go-libp2p#2142

@marten-seemann
Copy link
Contributor Author

The only place in libp2p where we used this is when checking relay reservation constraints. It should therefore be sufficient to initialize when starting the relay: https://github.com/libp2p/go-libp2p/pull/2143/files#diff-ed9fde63e4a5b43b6256b213dc16a0c0cb662c4e5471327c795bfe7867234f87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants