libp2p / js-libp2p-kad-dht

JavaScript implementation of the DHT for libp2p
https://libp2p.io
Other
141 stars 60 forks source link

fix: use events to delay before self-query #478

Closed achingbrain closed 1 year ago

achingbrain commented 1 year ago

Instead of debouncing and using timeouts to wait for DHT peers before running the initial self-query, instead get the routing table to emit events when peers are added or removed - if the table is empty when we run the self-query, wait for the peer:add event before continuing.

Improves startup time.

Adds tests for the query-self component.

achingbrain commented 1 year ago

It’s an internal component so not a breaking change.

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 9.3.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: