This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
fix: wait for self-query to have run before running queries #457
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to run a query we need DHT peers. The most common way to find these is to run a self-query which happens after startup. There's no way for the users to know when this has happened so they end up putting arbitrary waits into the code so their queries have a better chance of succeeding. Instead just delay all queries until the self-query has run and found some peers, then continue with the queries.
…before-running-queries
…before-running-queries
maschad
approved these changes
Apr 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
achingbrain
added a commit
to libp2p/js-libp2p
that referenced
this pull request
May 4, 2023
js-libp2p occasionally gets all peer routers to run a query for it's own node id. The only module that actually requires this is kad-dht in order to insure it has peers when it runs a query and it does this anyway since it's part of the spec. libp2p/js-libp2p-kad-dht#457 also updates kad-dht to pause all executed queries until the self-query has run. Consequently this is redundant and just creates unecessary work.
github-actions bot
pushed a commit
that referenced
this pull request
May 4, 2023
## [9.1.1](v9.1.0...v9.1.1) (2023-05-04) ### Bug Fixes * wait for self-query to have run before running queries ([#457](#457)) ([9d5bdb9](9d5bdb9))
🎉 This PR is included in version 9.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
achingbrain
added a commit
to libp2p/js-libp2p
that referenced
this pull request
May 5, 2023
js-libp2p occasionally gets all peer routers to run a query for it's own node id. The only module that actually requires this is kad-dht in order to insure it has peers when it runs a query and it does this anyway since it's part of the spec. libp2p/js-libp2p-kad-dht#457 also updates kad-dht to pause all executed queries until the self-query has run. Consequently this is redundant and just creates unecessary work. Co-authored-by: Chad Nehemiah <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to run a query we need DHT peers. The most common way to find these is to run a self-query which happens after startup.
There's no way for the users to know when this has happened so they end up putting arbitrary waits into the code so their queries have a better chance of succeeding.
Instead just delay all queries until the self-query has run and found some peers, then continue with the queries.