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

fix(sync): properly drop rpc subscriptions, add doc status #1396

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

Frando
Copy link
Member

@Frando Frando commented Aug 23, 2023

Description

So far in #1333, if a RPC or in-memory client called doc.subscribe() the event callback would never be dropped, even if the client did drop the event stream. This PR fixes this, by having the event callbacks return whether the callback should stay active or not. We can't use the removal token here, because calling LiveSync::unsubscribe from within the event callback would deadlock the actor.

Also adds a a LiveStatus to the doc info RPC call. For now only contains the number of subscribers. More info, e.g. on peers, can come later.

Notes & open questions

  • As of feat: add iroh-sync and integrate into iroh node #1333 and unchanged by this PR: doc.subscribe will fail for documents that are not in the LiveSync (they are added via doc.import or doc.start_sync). This is unfortunate, because you'd often want to setup a subscription before starting sync, to catch all events.

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@Frando Frando merged commit 0e3f169 into sync-integration Aug 24, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants