-
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
chore: minor refactoring for protocols #1762
Conversation
size-limit report 📦
|
ccadd63
to
2b45d34
Compare
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 am confused by the tests deletion
maxBootstrapPeers | ||
); | ||
|
||
const sortedFilteredPeers = await sortPeersByLatency( |
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.
Documentation of the function needs to be updated.
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.
Can you elaborate?
Doc for sortPeersByLatency
was updated.
For the parent function getPeers
, it has a generic definition that wasn't falsy. Updated it for more verbosity: 02aeab8
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.
@fryorcraken merging this now
please let me know if you would prefer any follow up -- thanks!
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 ✅
babefc7
to
13ce861
Compare
BaseProtocol
housedgetPeer
as well asgetPeers
with very close naming.getPeers
is used to find peers for a protocol, & filter according to discovery mechanism prioritization.getPeer
simply found lowest latency peer for the protocol (while this was not required by the way it was being used after we introducedgetPeers
)This PR:
getPeer
function and directly usespeerStore.get(peerId)
to find a peerpeerId
is made mandatory on the params for peer-exchange querygetPeers
is used in all other protocols and the lowest latency sorting is addedNotes:
selectPeersForProtocol
& refactored test added