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:
2026-07-04 06:43:04 +02:00
parent 516b385178
commit 6b183c72af
3 changed files with 30 additions and 0 deletions
+4
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]