Repository navigation
fix(playback): warm catalog prefetch on detail reads, retry slow transcode manifests - #221
Merged
Merged
Conversation
…scode manifests Clients press play straight from catalog/season lists without a watch-detail read, so the watch-detail prefetch never fired. Item detail and season-episode reads now warm the same bounded cache, and the file-level gate plus a 4-slot load semaphore keep high-volume reads from fanning out. Slow-but-alive transcode manifests answer retryable 503 (not_ready_retry + Retry-After) instead of a terminal error, and the web player polls the manifest again while startup is still in flight instead of burning the fatal budget.
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
Related issue: N/A
Validation tasks: none
Cold virtual starts still pay a full 3-7s provider list: clients press play straight from catalog and season lists, and the watch-detail prefetch from the earlier change never fires because no client reads watch detail first. Separately, a slow-but-alive transcode encoder answers a terminal-looking 503 while FFmpeg is still producing, and the web player burns its fatal budget instead of polling again.
Approach
Warm the same bounded best-result cache from the reads clients actually make: item detail warms its versions, season-episode lists warm the first episode's files only. A file-level admit gate plus a 4-slot load semaphore keep high-volume catalog reads from fanning out row loads before the existing bounded prefetch queue.
Manifest polls distinguish slow-alive from dead: alive-but-slow answers retryable 503 (
not_ready_retry+Retry-After), and the web player reloads the manifest source while startup is still in flight instead of counting it against fatal recovery. Post-startup failures stay on the fatal path.Validation
go build ./...,gofmt,go vet: clean-raceon prefetchpnpm run lint0 errors, prettier clean, newmanifest-not-ready+ guard suites passsync.Once, invalid-200-stub rejected in favor of retryable 503)Risks
Prefetch stays speculative: first-2 file IDs, virtual-only filter, shed-when-saturated. Catalog reads gain a bounded background load, never response latency. Manifest
not_ready_retryis a new code web clients poll on; other clients see a plain 503 withRetry-Afteras before.Before / after
Checklist
AI Disclosure