Skip to content

Library: stop polling failed and gone clips, one pass at a time - #60

Merged
pallaoro merged 3 commits into
mainfrom
media-poll-once
Oct 10, 2026
Merged

pallaoro merged 3 commits into
mainfrom
media-poll-once

Conversation

@pallaoro

Copy link
Copy Markdown
Member

An open editor at a client asked /api/assets/<id>/playback about 61.7k times a day for 8 library clips whose video the media service had given up on ({"ready":false,"state":"error"}): useMediaReady polled every not-ready clip every 5 s with setInterval, 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:

Checks: tsc, 168 unit tests, end to end ALL OK, build.

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.
@pallaoro
pallaoro merged commit 12fa3d4 into main Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant