Files
photoreport/apps/api/src
paula-alves d2616ce539
ci / typescript (push) Skipped
ci / rust (push) Skipped
ci / rust (pull_request) Successful in 6m9s
ci / typescript (pull_request) Successful in 11m47s
fix(worker): account for worker deploy overlap in DB connection budget (BIT-33530)
dbConnectionBudget reserved room for an API deploy overlap (apiReloadOverlap,
BIT-31550) but not for a worker deploy overlap. PM2 startOrReload on the
fork-mode photoreport-worker starts the new process before the old one finishes
its 25 s drain, so both Prisma pools and both broadcasters are open at once.
With defaults that is 2 * (47 + 1) + 26 = 122 > 100 max_connections, tipping
Postgres into error 53300 "sorry, too many clients already".

Add workerReloadOverlap (default 1) that divides the remaining budget by the
number of concurrent workers, so the total stays under max_connections even
during a reload. The worker's Prisma pool drops from 47 to 23 with defaults —
enough for the concurrent jobs the capacity planner sizes, and the headroom
and ad-hoc connection margin are preserved.

Paperclip-Issue: BIT-33530
2026-12-04 09:20:43 +00:00
..