Repository navigation
Keep a call alive while its work reports signs of life - #116
Merged
Merged
Conversation
attachCallLiveness(source) takes a CallLivenessSource whose signals restart the repeat window and the REST attempt idle timeout of the calls with that Idempotency-Key; waiting: true holds the window until the next signal or detach. Version 0.16.5.
✅ Incremental coverage — 100%
12 files not graded (2 ignored by pattern, 10 not source files)
Coverage reports: coverage.json (coverage.py, 76 files) · coverage/clover.xml (clover, 17 files) — incremental-coverage-check v3.1.0 |
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.
A call whose action runs longer than
repeat.withinMsrejects in the browser although the action still runs on the server and reports progress. This adds an extension point through which the work behind a call reports signs of life to the proxy; fastapi-viewsets imports nothing from the reporter (taskwire attaches it fromviewsetCallSource()).API (npm)
attachCallLiveness(source: CallLivenessSource): () => void, registration as a set of sources; attaching one source twice returns the first detach function.CallLivenessSource { subscribe(listener: (signal: CallLiveness) => void): () => void }CallLiveness { key: string; waiting?: boolean }—keyis the call'sIdempotency-Key.Each signal for an unsettled call's key:
withinMsafter the last signal;attemptTimeoutMs) of its current REST attempt (CallAttempt.alive()).A muxws attempt keeps
timeoutMsfrom its start; an attempt that reaches it is repeated andIdempotencyattaches the repeat to the running action, so only the window applies there. A call whose work stops signalling rejects with the first attempt that ends without an answer at or pastwithinMsafter its last signal.waiting: true(work waiting on a user's answer) holds the window until the same source signals the key withoutwaiting, or is detached; detaching releases the holds and the window counts from then. A muxws repeat waiting for a reconnect of a held call is not cut short (setTimeoutdelay clamped).Docs
Idempotency guide (new Call liveness section, option table), API page (types, function),
route_rest,vue-mixinsandroute_muxwsoption rows.Version
0.16.5 (patch; Python and npm packages), changelog entry added.
Tests
New
vue/call-liveness.spec.ts: a REST call against anIdempotencystand-in that runs 90 s with a signal every 15 s resolves (withinMs20 s); a call whose signals stop rejects exactlywithinMsafter the last one; signals outpacingattemptTimeoutMskeep one attempt;waitingholds and releases; detach releases; another key is ignored; two calls with one key both move; muxws repeats pastwithinMswhile signals arrive, and a held call waits for a reconnect. No existing test changed.