Skip to content
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: Add options to broadcast Peer info on seeing a new subscription #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

justin0mcateer
Copy link

The existing options allow only for publishing the current Peer's info on a fixed interval, and once automatically at start up. However, when a new peer joins which is also participating in the PubSub Peer Discovery process, it has to wait until the next interval to receive notification of existing peers. This creates an unnecessary trade-off between a low broadcast interval (causing lots of chattiness) or a long delay until peer discovery.

The PubSub interface provides the ability to see when new peers have subscribed to various topics. This patch adds a very small amount of optional logic to broadcast our peer info reactively when we see new peers on the topic. The default configuration is to disable this functionality unless the user specifically opts in.

Also, if there were a large number of peers participating in the PubSub Peer Discovery process, having them all broadcast their peer details in synchronization would create somewhat of a 'thundering herd' problem. Therefore, I have included a configurable randomized delay for this reactive broadcast. By default it is a fraction of the broadcast 'interval', but can be configured as desired.

@justin0mcateer justin0mcateer changed the title Add options to broadcast our Peer info on seeing a new subscription feat: Add options to broadcast our Peer info on seeing a new subscription Aug 31, 2023
@justin0mcateer justin0mcateer changed the title feat: Add options to broadcast our Peer info on seeing a new subscription feat: Add options to broadcast Peer info on seeing a new subscription Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant