-
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
feat: use metadata protocol for awaiting connection to remote peer #1759
feat: use metadata protocol for awaiting connection to remote peer #1759
Conversation
size-limit report 📦
|
73223f6
to
2e400ec
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 would suggest to have an event for the metadata protocol such as "shard info received" and use this as a way to track whether the protocol has been run.
I think this PR should be prefixed with |
changed to |
This way of checking was used because on the off chance the service node does not send a request to us, or takes more time (which it is gauged by manual tests), we will initiate a request and ensure/enforce that we are on the same shard. Let me know if you think otherwise @fryorcraken |
Merging this PR for now. Happy to address the proposed change of moving to an event-based functionality as a followup if decided. |
1e793dd
into
feat/shard-peer-selection
Problem
Parent/origin: ##1756
There is a requirement to wait for ~50/100ms after a
peer:connect
event is fired as the Metadata Protocol is an async operation for which we need to wait to populate shard info, or we are disconnected if there is a cluster ID mismatch.We need to wait for the Metadata protocol to complete before we can assume the peer is ready to be used to open connections reliably.
Solution
waitForRemotePeer
cluster-id
shard
nwaku#2259)Notes
Can still foresee a case where a peer that is connected is used for a protocol instantly, thus creating a race condition.
Perhaps a more protocol-knit check should be added. Will also be helped with #1463