fix(api): wait for Postgres and Redis at startup instead of crash-looping (#537)

Briefly retry Postgres and Redis connectivity at boot (waitForService, DB_STARTUP_TIMEOUT_MS) so an ordered-but-not-yet-ready dependency recovers cleanly instead of crash-looping.
This commit is contained in:
SnapOtter
2026-07-16 22:50:11 +08:00
committed by GitHub
parent 43ddf96ccf
commit 4ac89fe650
5 changed files with 167 additions and 3 deletions
+4
View File
@@ -67,6 +67,10 @@ APP_NAME=snapotter
DATABASE_URL=postgres://snapotter:snapotter@localhost:5432/snapotter
# Redis connection (required; this default matches docker-compose.dev.yml)
REDIS_URL=redis://localhost:6379
# Startup grace: wait this long (ms) for Postgres/Redis to accept connections
# before failing. Lets a dependency that is still booting recover instead of
# crash-looping. 0 = try once, fail fast.
DB_STARTUP_TIMEOUT_MS=30000
# Job spine tuning
SYNC_WAIT_MS=8000 # sync-response window (ms) before returning 202