-
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: choose peers from the connected pool, instead of dialing unconnected peers #2096
Conversation
fc45fd4
to
88a29c3
Compare
size-limit report 📦
|
Good initiative, we discussed this 2 weeks ago and reached some solution.
The problem was that when a protocol was trying to Also, there were some other problems that #2065 has solved, e.g it happened that As for solution we agreed that following logic makes sense:
|
15400a5
to
2b1b3ae
Compare
The errors received from nodes are RLN limits being hit. I suggest to iteratively dogfood and improve once we have infra sorted + bug tickets filed. |
2b1b3ae
to
9a5e3f3
Compare
this.log.warn("No new peers found."); | ||
this.log.warn("No new peers found, trying with bootstrap peers"); | ||
newPeers = await this.core.getPeers({ | ||
maxBootstrapPeers: numPeers, |
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.
shouldn't previous line return all bootstrap peers already?
I mean 0
is for returning all peers, right?
@@ -198,11 +198,6 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { | |||
this.log.info(`Finding and adding ${numPeers} new peers`); | |||
try { | |||
const additionalPeers = await this.findAdditionalPeers(numPeers); | |||
const dials = additionalPeers.map((peer) => |
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.
why is it removed?
@@ -227,10 +222,17 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { | |||
private async findAdditionalPeers(numPeers: number): Promise<Peer[]> { | |||
this.log.info(`Finding ${numPeers} additional peers`); | |||
try { | |||
let newPeers = await this.core.allPeers(); | |||
let newPeers = await this.core.getPeers({ |
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.
did you try this in practice, e.g dogfooding app?
I used allPeers
because getPeers
were not returning everything, and was limited for some reason
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.
left questions but looks good
let's dogfood it before merging, please
@danisharora099 should this PR be marked as draft as per waku-org/pm#186 (comment) ? |
pretty much continued by newer efforts related to protocol peer management #2137 |
Problem
With #2065, we changed the logic to fetch peers for a protocol from choosing from connected peers to finding all available peers (unconnected), and attempting to dial them instead.
This does not seem correct considering if the peer was dialable, it should have been connected already. If the peer is actually healthy, we can assume it has a connection open.
Solution
We should find connected peers that support the given protocol, and do not have a stream opened for that protocol yet, and then connect over that protocol.
Notes
I understand this change in #2065 was introduced because it was seen that in practicality peers weren't found when using this strategy, which seems like there is actually something else preventing it.
Will do further investigations.
This is also similar to #1758.