fix(worker): wait for the DB schema before starting (no crash-loop on fresh deploy)

The worker and API start in parallel; the API applies migrations on its own startup, so on a fresh
deploy the worker hit a missing download_jobs table and crash-looped until migrations landed. The
worker now polls for the schema before recovering orphans, and (belt-and-suspenders) the compose
files gate it on the API being healthy. Fixes the observed prod restart-loop on the v0.22.0 deploy.
This commit is contained in:
npeter83 2026-07-04 06:43:04 +02:00
parent fe822598fa
commit 524507ce9b
3 changed files with 30 additions and 0 deletions

View file

@ -84,6 +84,10 @@ services:
depends_on:
db:
condition: service_healthy
# Start only after the API is healthy (it applies the DB migrations on startup), so the
# download tables exist before the worker touches them.
api:
condition: service_healthy
bgutil-pot:
condition: service_started
networks: [internal]