Add maxRetries option to Meteor.apply#11
Open
mark1russell7 wants to merge 1 commit into
Open
Conversation
Bounds how many times an already-sent method is re-sent when a dropped connection is recovered. Once exhausted the method fails with the same 'invocation-failed' error as noRetry (maxRetries: 0 is equivalent to noRetry); unset keeps the default retry-forever behavior.
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.
Summary
Adds a
maxRetriesoption toMeteor.apply/applyAsync: the maximum number of times an already-sent method may be re-sent when a dropped connection is recovered. Once exceeded, the method fails with the sameinvocation-failederror thatnoRetryproduces (maxRetries: 0is equivalent tonoRetry). Unset preserves Meteor's default retry-forever behavior.This is the
maxRetriesfeature split out of #10 as a minimal, refactor-free change. The ExecutionGroup refactor from #10 will be proposed separately.Why
Between
noRetry(fail on first reconnect) and the default (re-send forever), there is no way to say "this method is worth retrying a few times, but must not outlive N reconnects." Unbounded re-send is a liability for non-idempotent methods on flapping connections;maxRetriesbounds it.Design notes
MethodInvoker— no scheduling changes.MethodInvoker.consumeRetry()owns the budget; the existingnoRetryfilter in_handleOutstandingMethodsOnResetis its single call site, sonoRetryandmaxRetriesshare one code path and one failure shape.invocation-failed(notdisconnected) so error handling written fornoRetryapplies unchanged.disconnectedremains the signal for "connection permanently down" (see Fix DDP method hang on disconnect and null socket in Session.close() meteor/meteor#14193);invocation-failedmeans "connection recovered, but this call gave up."Tests
maxRetries: 2— re-sent on reconnects 1 and 2 (same method id), fails withinvocation-failedon the 3rd;_methodInvokersand_outstandingMethodBlocksfully cleaned upmaxRetries: 0— never re-sent, fails on the first reconnect (same behavior and error code asnoRetry)