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

replicating with multiple peers #12

Open
dominictarr opened this issue Feb 20, 2018 · 0 comments
Open

replicating with multiple peers #12

dominictarr opened this issue Feb 20, 2018 · 0 comments

Comments

@dominictarr
Copy link
Contributor

if you connect to multiple peers at once, it's possible that they send the same messages. Especially in the case of the initial sync, this could result in transmitting many more messages than expected.

The most obvious solution would be to subscribe to activate transmit on only the first peer, but the others in lazy mode. however, then if the first peer just sends messages very slowly (including possibly so slowly it looks like not sending anything) you may get stalled, because currently you only switch peers when you receive a note from another peer.

so if A has {a: 5, b:5} and B has {a:5, b:5} and we are connected to both and have A sending a,b to us, but it pauses at a:3 and b:3, then we are just stuck, even though we could just ask B for those feeds.

I think the solution is to track the latest time we received a message from a peer, and if this is greater than some threashold, switch peers (randomly?) if there is some other peer more up to date than us.

It might also be a good idea when connected to peers to request from each peer randomly too.

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

No branches or pull requests

1 participant