-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix: don't dial discovered peers if have already been attempted dial #1657
Conversation
size-limit report 📦
|
ae340d5
to
7d15eb9
Compare
); | ||
await delay(100); |
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.
I see it was before here - but how do you think - is it possible to avoid?
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.
Moved this out of the loop, right before we check the call count.
We need to add a little delay before we check for the call count to ensure the async operations within have completed.
Also refactored the test to check for callCount to be >= discovery events fired instead of callCount === events emitted as attemptDial
should take care of the redundant cases that may arise from dialPeerStorePeers
dd61e68
to
7b1b3c5
Compare
9ed7fa8
to
6bca81a
Compare
Problem
When we discover new peers, a dial attempt is fired. If this discovery is emitted multiple times, it currently does not check if there is an active dial attempt for this peer, or if we've already tried to dial this peer before.
This is unwanted behaviour as we might trigger dial attempts for peer that have already been attempted.
Solution
Do not dial peers if they have already been attempted dial before (will be handled with reconnections), or if they have a dial attempt in progress
Notes
ConnectionManager
for readability & maintainability #1658