-
Notifications
You must be signed in to change notification settings - Fork 186
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
allow waiting for enough peers in gossipsub #452
Conversation
FYI @adlrocha @masih @willscott for the time.Sleep TODOs in go-legs and indexer-reference-provider. |
@willscott another question is how to expose this via go-legs. Right now it calls NewGossipSub, which creates a GossipSubRouter and feeds it to NewPubSub. Unfortunately, that is then hidden behind an unexported field in One option would be to add another method, like:
Thoughts, @vyzo? |
Yet another option is to leave it up to the downstream to poll I'm new to this module and its design, though, so maybe there's a better design to be had here. |
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.
This should be part of the pubsub interface, not the router; all routers implement enough peers.
Also, thread safety...
Actually it should be in the topic interface. |
and there is also machinery for topic related events, which can make implementation of this much nicer. |
and there is already an option that more or less does what you want, it's called |
I saw that, but it doesn't do anything at all in our case, because we're not using
That's fine by me; I was just following |
then open an issue to discuss and agree on an api.
…On Thu, Sep 23, 2021, 13:57 Daniel Martí ***@***.***> wrote:
and there is already an option that more or less does what you want, it's
called WithReadiness.
I saw that, but it doesn't do anything at all in our case, because we're
not using WithDiscovery.
Maybe we could teach that option to also work without WithDiscovery? It's
unclear to me what API would be nicest.
Actually it should be in the topic interface.
That's fine by me; I was just following EnoughPeers. I can rewrite this
PR if we can agree on what API to add or modify.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#452 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAI4SRHWXSUQHCDAGWCDETUDMBXZANCNFSM5EOWP34A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Done: #454 |
thanks.
…On Thu, Sep 23, 2021, 15:08 Daniel Martí ***@***.***> wrote:
then open an issue to discuss and agree on an api.
Done: #454 <#454>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#452 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAI4SUR5FWUUDEFPPXCUYTUDMKCRANCNFSM5EOWP34A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I've updated the code to no longer be racy, I think - the added |
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 say this is good enough.
However, please don't change the gossipsub tests to remove the sleep, we want to test mesh formation with heartbeats.
Hm, I'm not sure I understand removing the sleeps from tests. Sleeping for two seconds or sleep-polling until the equivalent condition is met seems basically the same, just that sleeping makes the tests slower. I'm happy to revert those changes though, as I'm not the maintainer. If I'm not touching any of the existing tests, then it sounds like I need to add a new test to cover this feature. |
it's not the same condition; one allows the mesh to form, the other waits
for number of peers.
Yes, please add a new test for the readiness condition.
…On Thu, Oct 28, 2021, 19:43 Daniel Martí ***@***.***> wrote:
Hm, I'm not sure I understand removing the sleeps from tests. Sleeping for
two seconds or sleep-polling until the equivalent condition is met seems
basically the same, just that sleeping makes the tests slower. I'm happy to
revert those changes though, as I'm not the maintainer.
If I'm not touching any of the existing tests, then it sounds like I need
to add a new test to cover this feature.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#452 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAI4SSCQDZ5OB5LNBXTEA3UJGDSJANCNFSM5EOWP34A>
.
|
All done, I think. |
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.
looks pretty good - we just need to avoid unnecessary ticker allocations once we've got enough peers.
That is, when MinTopicSize is used but not WithDiscovery, Publish will keep waiting until MinTopicSize's condition is met. At the moment, this is done by polling every 200ms. In the future, the mechanism could be optimized to be event-based. A TODO is left for that purpose. Fixes #454.
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.
thank you!
(see commit message)