Repository navigation
Library: stop polling failed and gone clips, one pass at a time - #60
Merged
Merged
Conversation
A clip whose ingest ended in the media service's "error" state never becomes ready, but the library kept asking about it every 5 seconds for as long as the editor stayed open. Such clips now drop out of the poll and their tile says they could not be prepared.
useMediaReady asked about each pending clip in turn and started a new pass every 5 s with setInterval, whether or not the last pass had finished. A pass over a few hundred clips takes minutes, so the passes piled up (over a hundred at once in the test's model) and each one went on asking about every clip, including after the hook had moved on. Passes now run through repeatPasses: the next one starts 5 s after the last finishes, and a pass stops partway once the set it was asked about changes.
A clip deleted while an editor was open, or whose video is no longer on the media service, answered 404 (or 502 not_found) on every pass, and each was taken for a hiccup and asked about again, every 5 s, for as long as the editor stayed open. Gone is now as final as the media service's error state: the clip is no longer asked about. playbackVerdict() says what each answer means; api.get's errors carry the status and the service's code.
This was referenced Oct 10, 2026
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.
An open editor at a client asked
/api/assets/<id>/playbackabout 61.7k times a day for 8 library clips whose video the media service had given up on ({"ready":false,"state":"error"}):useMediaReadypolled every not-ready clip every 5 s withsetInterval, so error states never left the set, and passes stacked when a pass outlasted 5 s.This carries #44 and #50, rebased onto today's main (cherry-picked, authors kept), and supersedes both:
state: "error"is no longer polled, and the library says it could not be prepared.repeatPasses: one pass at a time, 5 s after the last one ends, stopping partway when the set changes (unit tests with fake timers).404, or502 not_foundwhen its video is no longer on the media service) is final too, instead of a hiccup asked about forever.playbackVerdict()(pure, unit tested) maps each answer;api.geterrors now carrystatusandcode(message unchanged).Checks: tsc, 168 unit tests, end to end ALL OK, build.