Add opt-in season cascade to series ingestion
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s

Ingesting a series only ever produced season stubs -- getting actual
episodes meant calling POST /admin/ingest/season once per season by
hand, which is exactly what manual end-to-end testing kept requiring
for every multi-season show.

POST /api/v1/admin/ingest/series now takes include_seasons (default
false, since a show can have dozens of seasons and that's dozens of
TMDb calls fired from one request). When true, ingest_series_task
fans out one ingest_season job per season once the series succeeds,
using arq's own ctx['redis'] connection for the job (the same pattern
arq's docs recommend for job chaining) rather than a second unrelated
connection. Each fanned-out season job still goes through
get_or_create_ingestion_job, so re-running a cascaded series ingestion
reuses the same season job rows instead of creating duplicates.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 02:03:25 -05:00
co-authored by Claude Sonnet 5
parent ec6b5bdd7d
commit b4d1e8f755
6 changed files with 148 additions and 6 deletions
+6 -3
View File
@@ -171,6 +171,9 @@ indexes on the alternate-title tables. See
- `ingest_series` only upserts season *stubs* (number, title, air date,
poster) — episodes require a separate `ingest_season` call per season
(TMDb has no single endpoint returning a whole series' episodes), and
that call requires the series to already exist. There's no orchestration
yet that walks all of a series' seasons automatically after
`ingest_series` succeeds.
that call requires the series to already exist. `POST
/api/v1/admin/ingest/series` can cascade this automatically
(`include_seasons: true` fans out one `ingest_season` job per season from
`ingest_series_task` once the series succeeds, via arq's own `ctx['redis']`
— see `app/workers/tasks.py`), but it's opt-in: some shows have dozens of
seasons, each a separate TMDb call, so cascading isn't the default.