Repository navigation
fix: finish video persistence and billing after disconnects - #146
Merged
Merged
Conversation
log_access runs inside the submit task; without the span the gw.* fields are not recorded when the OTLP layer is on.
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.
Async video requests could leave permanent partial state when a client disconnected: a submitted vendor job lost its local handle, or a completed job stayed marked billed without consuming its cost budget. Normal retries could not reconstruct the missing job or re-enter the already claimed settlement.
donepoll, let one task own the atomic first-settlement claim through ledger writing and budget consumption. Both video read routes use this path; the existing claim still prevents duplicate charges.The ownership gaps date to async video support in #34; #99 added completion-budget accounting inside the same cancellable path. #145's asynchronous user-budget lookup makes the latter trigger straightforward, but did not introduce the underlying cancellation gap.
Validation:
db2e82e189b06af6186848c831f9ddb1c15a15d5and pass with this fix.cargo test --workspace --locked --offlinereports 704 passed, 0 failed, 4 ignored.donepoll; the same submit on main left no job row.Performance: submit still creates one task. Pending, failed, and nonbillable polls create none. Each billable-done poll, including a repeated poll whose claim returns false, now creates one task and awaits its result. Job/account/key values move into that task; storage operations, upstream calls, locks, and retry policy are unchanged. The Rust production diff is net +9 lines. Existing throughput benchmarks do not isolate this video-completion path, so no latency improvement is claimed.