feat: record on the entry whether a DDP subscription is a Confirmed sub - #362
Open
diegolmello wants to merge 22 commits into
Open
feat: record on the entry whether a DDP subscription is a Confirmed sub#362diegolmello wants to merge 22 commits into
diegolmello wants to merge 22 commits into
Conversation
…nection whenReady(streams, timeoutMs?) replaces resubscribeWhenRecorded: a query over the recorded Confirmed subs that sends no sub of its own, matches exactly, never rejects, and resolves false at the deadline. The 100ms poll dies with it; the re-send stays in subscribeAll on Login. Closes #312
…subscription-readiness # Conflicts: # docs/adr/0006-a-sub-abandoned-by-a-forced-reconnect-keeps-its-entry.md # lib/clients/Rocketchat.ts # lib/drivers/__tests__/driver.spec.ts # lib/drivers/driver.ts
One fact in one place: forgetting the entry forgets the confirmation, so forgetSubscription no longer keeps a shadow set in step. A waiter hears about a confirmation through the Socket's own emitter instead of a second notification mechanism beside it.
The field the readiness path reads was only compiling through the index signature, so a typo passed silently and consumers compiling this source saw nothing of the domain term. ADR-0011 now describes how the readiness path actually reads findSubscriptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #312.
Proposed changes
createConnectionandonClose, so every sub turns Unconfirmed the moment the connection ends.forgetSubscriptiondeletes the id with the entry.resubscribeWhenRecordedwithwhenReady(streams, timeoutMs?)onISocket, and on the Driver and Client pass-throughs.whenReadyis a query on the recorded entries. It sends nosubDDP message. It matches a stream exactly: same name, same number of params, each param equal. It never rejects. It resolvesfalsewhen the Deadline rings, and waits the deadline out rather than answering early when no entry exists yet. The 100 ms poll is gone — resolution is pushed fromconfirmSubscriptionto the waiting listeners.waitForNotifyUserMediaSubskeeps its signature and callswhenReady. The re-send of the media streams stays insubscribeAllon Login. A Reopen sends nothing. On a reopened connection without a Login, the entries stay Unconfirmed, and the query resolvesfalseat the Deadline. Before this change, that path re-sent the streams, the server refused them, and the refusal deleted the entries.Behaviour change on the call-accept path: after a forced reconnect without a Login,
waitForNotifyUserMediaSubsresolvesfalseinstead of re-subscribing. The re-send on that path returns with #359 (Resume on Reopen). #360 tracks the two divergentnosubshapes found along the way.Steps to reproduce
stream-notify-usermedia streams and let the server confirm them.whenReadyresolvestruewith no more DDP messages on the wire.subDDP message goes out on the new connection. The entries stay.whenReadyresolvesfalseat the Deadline.subscribeAllre-sends the streams. The server confirms them, andwhenReadyresolvestrue.Tests
whenReadyresolves true once both streams are Confirmed subswhenReadywaits out the deadline and resolves false when no entry existssubDDP message is sent, resolves false at the DeadlinewhenReadyleaves no timer behind on either pathwhenReadywith no streams asked resolves trueid/name/paramskept untouched