Repository navigation
fix: wait for media subs acked on the attached transport instead of re-sending them - #440
Merged
Merged
Conversation
3 of 10 tasks
A ready frame can list several subs; Meteor sends one after a login re-runs the connection's subs. The socket emitted it under subs[0] only, so a later sub sent for the first time never resolved, got no record for the ready listener to mark, and stayed not ready on that transport after its deadline.
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.
Proposed changes
Driver.waitForNotifyUserMediaSubsno longer re-sends the media subscriptions. It resolvestrueonce bothmedia-signalandmedia-callshave areadythat arrived on the attached Transport, andfalseon its deadline.The old wait re-sent a
subunder an id that was usually already active. Meteor's ddp-server (monolith) ignores such asub: noready, nonosub. So on monolith servers the wait always ran out, and the app ended every call accepted from the native call UI. ddp-streamer answers a duplicatesub, which is why microservices servers worked.How it works:
subitsreadyanswered. Only areadywith a subscription id counts, and only while that Transport is still attached.sub, or written offline, is not ready. Forgetting an entry, or sending itsunsub, clears its readiness.subbecomes ready if itsreadylands later on the attached Transport. Without this, areadyslower than the 10s request deadline left the stream not ready for the life of the connection, and every native accept ended after 8s until the next reopen.readys from thesubscribeAllthat follows the resume login make the streams ready again.Socket/Driver/Rocketchat.resubscribeWhenRecordedis replaced bywaitForStreamsReady(same arguments, sends nothing).IDriverchanges accordingly. The app is the only consumer and calls onlywaitForNotifyUserMediaSubs.This also closes two other ways the old re-send went wrong:
subcould reach the server before the DDPlogin. The app's login does a REST call first. The server refused it withnosub, the SDK deleted the record, and later calls stopped ringing.ADR-0016 records the decision and marks the bullets of ADR-0006, ADR-0011 and ADR-0012 that described the old wait.
Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1925
How to test or reproduce
npm test,npm run typecheck,npm run lint.lib/drivers/__tests__/driver.mediaSubs.spec.ts, "resolves true at once, sending no sub, when both media subs were acked on the attached transport", is the regression test for the monolith failure.ready.subas ready before itsreadylands;readycame from;Types of changes
resubscribeWhenRecorded, which is renamed and no longer sendsFurther comments
A model check of the app's accept gate against this design passes in every scenario. It covers monolith and microservices, an alive socket, a forced reopen, a socket lost while the gate waits, and a
readythat lands after itssubexpired. Without the "attached Transport" condition, the gate answers on dead subscriptions after a reopen. Without the late-readyhandling, the gate ends the call on a live socket.