-
Notifications
You must be signed in to change notification settings - Fork 22
Resolve sync
only after heads have been added
#38
Conversation
This first checks if anything is in the queue or buffer to be processed. If so, then it waits for a `replicate.progress` event (where the progress is complete) and then waits for the `replicated` event. The downside to this is that if other things are being added to the queue rapidly, then this may hang indefinitely. That said, currently as this is used in orbit-db, this would not block anything other than the new event I have proposed adding, so it should be fine? Ideally, what should really happen is that we should have a way of knowing when the items derived from the given heads have been replicated. Currently, however, the queue is a black hole and there's no way to track the graph that branches out from the heads. The queue would likely need to be refactored for this approach.
Until - orbitdb/orbitdb#606 and - orbitdb-archive/orbit-db-store#38 are merged
Until - orbitdb/orbitdb#606 and - orbitdb-archive/orbit-db-store#38 are merged
@chmanie Thank you for the clarification. Can you and @tyleryasaka work to get the event listeners cleaned up? |
const saved = await mapSeries(heads, saveToIpfs) | ||
await this._replicator.load(saved.filter(e => e !== null)) | ||
|
||
return new Promise(resolve => { |
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 feel like this also needs a timeout to be rejected at some point
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.
Not sure I follow, why would you want to do that?
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.
resolve
is wrapped in conditionals both of the times. Are we sure one of those is always going to happen?
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'm pretty sure yes. If not something with the replication logic would be broken
So basically just removing the event listeners before resolving the promise? @chmanie |
Yeah, that should do. |
@tyleryasaka Would you be able to remove those event listeners? If so then we can merge this and the commensurate PR in |
This is required for a tentative solution to orbitdb/orbitdb#509:
orbitdb/orbitdb#514
See this commit message for a more detailed explanation.