Repository navigation
fix(engine): cancelling the task that awaits load() ends the load at once (Sodalite#173) - #683
Merged
Merged
Conversation
…once (Sodalite#173) A host that cancelled the Task awaiting load() (a zap past an unreachable live origin) waited out the whole connect and retry budget, 19 s on the reporter's box, and every zap queued behind it. load() now installs a task cancellation handler that tears the in-flight load down the way stop(resetDisplayCriteria: false, finalTeardown: false) does, guarded on the load's own generation, so a cancellation that lands after a newer load or after the load returned touches nothing. A load started on an already cancelled task throws before it tears down the running session, and a load following an AE#629 takeover cancels the rebuild it follows. The AVIOReader size-probe ladder now polls isClosed instead of waiting out a fallback's 0.75 s stagger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… would (Sodalite#173) The first round ended a cancelled load with a host stop(), which dropped the native host and AVPlayer (#15) and an AE#158 handover item that the next load's own teardown would have kept, so every zap that cancelled a load lost AVPlayer reuse. The cancelled generation is now ended with the supersede teardown (native host and handover item kept, panel mode kept, no audio-session release) plus the published reset to .idle. A load following an AE#629 rebuild no longer cancels the rebuild's Task, which the retained-reader branch never observed; it ends the rebuild's generation instead, and the rebuild unwinds at its own checkpoints. A load cancelled before it began withdraws a reroute's #361 continuation, and AVIOReader no longer logs streaming mode for a closed size ladder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eroutes (Sodalite#173) A load following an AE#629 rebuild ended only the generation the rebuild's teardown opened, which misses a rebuild whose load() rerouted into a nested load() (AE#678, AE#363, AE#246/268, #168/#199): the follower threw over a session that kept starting. Cancelling the follower now also cancels the rebuild's Task, so load() and its reroutes end through their own generation-guarded handlers, while the retained-reader branch is still ended by its generation. A custom-source reloadAtCurrentPosition() that a stop() or a cancelled load superseded returned as if it had rebuilt, so the escalation logged "rebuilt on the software path"; it now throws CancellationError, and a retained-reader reopen aborted by that supersede is no longer published as a failed reload. The docs say what a cancel leaves held until the next load() or stop(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem (device log, Sodalite live zap): a
.custom(HLSLiveIngestReader)load against an unreachable provider kept running for 19 s (open_input 18987mswhile the ingest retried its playlist).load()ignored Swift task cancellation, so a host that cancelled the load (a zap to the next channel) still had to wait it out, and every press in between queued.Change
load(...)now ends the load promptly withCancellationError(measured ~30 ms instead of the full connect budget), for URL and.customsources..idle, generation bumped, native host and AVPlayer kept for the next load (fix(native): apply externalMetadata on iOS too #15 reuse, AE#158 handover), display criteria and audio-session membership untouched. A host that leaves on cancel callsstop().load()or astop()started; a cancel that lands after the load reached its final state but beforeload()returned ends that session and throws.reloadAtCurrentPosition()now throwsCancellationErrorlike the URL branch already did, so the escalation no longer logs a false "rebuilt on the software path".stop()during a URL open.Tests: 16
CancellableLoadTests(RED before for the cancel paths, AVPlayer reuse, nested-reroute rebuild, startup continuation, superseded custom reload); fullswift test: XCTest 655 tests, 0 failures; swift-testing 3984 passed. tvOS and iOS builds succeed.🤖 Generated with Claude Code
https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS