Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

fix: discover peers faster #86

Merged
merged 1 commit into from
Jan 3, 2019
Merged

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented Jan 3, 2019

Previously we had to wait 10s (by default) before initial peer discovery, since the module uses an interval to re-emit discovered peers every 10s. This PR refactors start to do an initial discovery of the boostrap peers immediately after it has started (i.e. after the callback has been called).

This addresses the problem where a call to cat/get/others immediately after the IPFS ready event would take at minimum 10s to get content stored on the preload nodes due to the initial delay in discovery.

fixes #85
resolves ipfs/js-ipfs#1706

Previously we had to wait 10s (by default) **before** initial peer discovery, since the module uses an interval to re-emit discovered peers every 10s. This PR refactors `start` to do an initial discovery of the boostrap peers immediately after it has started (i.e. after the callback has been called).

This addresses the problem where a call to `cat`/`get`/others immediately after the IPFS `ready` event would take at minimum 10s to get content stored on the preload nodes due to the initial delay in discovery.

fixes #85
resolves ipfs/js-ipfs#1706

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
@ghost ghost assigned alanshaw Jan 3, 2019
@ghost ghost added the status/in-progress In progress label Jan 3, 2019
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vasco-santos vasco-santos merged commit 63a6d10 into master Jan 3, 2019
@ghost ghost removed the status/in-progress In progress label Jan 3, 2019
@vasco-santos vasco-santos deleted the fix/discover-peers-sooner branch January 3, 2019 14:20
@vasco-santos
Copy link
Member

@alanshaw released [email protected]

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

Successfully merging this pull request may close these issues.

Waiting 10s BEFORE discovering bootstrap nodes? Lag on catReadableStream (possibly other stream methods as well)
2 participants