-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Don't replicate zero length feeds #56
Comments
Possible edge case: I connect to a cabal, read some backlog, then leave. I return the next day, still not having posted anything yet, and now nobody will ever replicate my feed again (because it's |
cc @telamon |
@noffle yes, that pretty much sums it up, if you're a lurker then you won't unnecessarily tax the network you'll just act as another seed, |
Ah, but how will other users know that that person has a non-empty feed
if they refuse to sync with them when it's length=0 locally? :)
|
@noffle The peer shouldn't be filtered, only zero length feeds would be rejected. So a user with a zero-length writer should behave like I'm thinking of letting other peers know there's a new feed that is qualified for replication the same way that the active feed forwarding works. When an peer with established connections suddenly becomes aware of a new feed the _onFeedReplicated handler is invoked that forwards the feed to all other connected peers that dosen't have it yet. So the same needs to be done on the peer that has a zero-length writer when the first entry is written. But anyway, at the moment of writing, in order to manually notify connected peers that your writer is no-longer empty we could do the following: const writer = multi.feed('local')
writer.on('append', () => {
if (writer.length === 1) {
multi.replicationManager.connections.forEach(conn => {
multi.replicationManager._onFeedReplicated(conn, writer.key)
})
}
}) I'm adding to my TODO to expose an Did i manage to answer the question? |
from irc
The text was updated successfully, but these errors were encountered: