feat: refresh the catalog automatically - #641
Merged
Merged
Conversation
Catalog refresh became operator-only on 2026-07-19 when page loads stopped triggering it, and nothing replaced the trigger. The production catalog then went two months without a refresh: new seasons were unknown and the wrong season was held as current. - A leader-owned worker starts an inventory-only refresh when the last finished one is older than media.catalog_refresh_hours (default 6, 0 off). It re-runs a refresh interrupted by a restart, waits 30 minutes after a failed one, and honours the background-work pause. - The catalog reads as stale after two missed intervals instead of 15 minutes. Refs #638 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The smoke fixtures have no media files behind them. In CI the fixture server ran past the worker's first check, a refresh marked every fixture missing, and the route smoke lost its seeded review links. Co-Authored-By: Claude Fable 5.1 <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.
Why
Catalog refresh became operator-only on 2026-07-19 (
ddd0c6c1rightly stopped page loads from starting scans) and nothing replaced the trigger. The production catalog then went two months without a refresh: Futurama Season 11 (added in August) has no library rows, so Season 10 is held as the current season. Refs #638.What changed
catalog-refresh-workerchecks once a minute (first check a minute after startup) and starts an inventory-only refresh when the last finished full refresh is older thanmedia.catalog_refresh_hours(default 6,0turns it off).maybe_schedule_scan, so it honours "Pause new background work", never overlaps an active scan, and re-runs a refresh that a restart interrupted. After any other failure it waits 30 minutes.Root cause note for the scan history
All 3,407
scan_runsrows arefailedbecause migration20260731_0020addedstatuswith a default ofrunningand then marked everyrunningrow failed, including scans that had finished. Scans were not failing; the history cannot be restored because the same statement filled incompleted_at. The first automatic refresh giveslatest_scan_completed_ata real row.Not in this PR (tracked in #638)
Settings UI for the interval, a missing-credentials notice, and carrying provider credentials to a new runtime checkout.
Tests
New tests for due, not due, turned off and paused; the staleness test follows the interval; the worker-start test covers the new worker. Full gate passed.
🤖 Generated with Claude Code