The ensureCloudM19Target and ensureCloudW17Target calls fire concurrently at worker startup. During a deploy overlap (two workers live briefly), the Postgres server hits max_connections and these one-shot queries get P2037.
The .catch() handler logged at warn with the raw error, which triggered the reporter logHooks and paged the error loop.
Fix
Follow the same pattern as develop, sports, and archive workers: check isPrismaTooManyConnections and log at info (below the reporter warn threshold) so the error loop stays quiet. The targets retry on the next worker restart.
Also adds tests for isPrismaTooManyConnections covering the P2037 code, bare message, P2010/53300 raw-query variant, and negative cases.
Testing
npx vitest run apps/api/src/lib/pg.test.ts — 34 passed
npx vitest run apps/api/src/delivery/ — 15 passed
pnpm --filter @photoreport/api typecheck — clean
Paperclip-Issue: BIT-33558
## Summary
The `ensureCloudM19Target` and `ensureCloudW17Target` calls fire concurrently at worker startup. During a deploy overlap (two workers live briefly), the Postgres server hits `max_connections` and these one-shot queries get P2037.
The `.catch()` handler logged at `warn` with the raw error, which triggered the reporter `logHooks` and paged the error loop.
## Fix
Follow the same pattern as `develop`, `sports`, and `archive` workers: check `isPrismaTooManyConnections` and log at `info` (below the reporter warn threshold) so the error loop stays quiet. The targets retry on the next worker restart.
Also adds tests for `isPrismaTooManyConnections` covering the P2037 code, bare message, P2010/53300 raw-query variant, and negative cases.
## Testing
- `npx vitest run apps/api/src/lib/pg.test.ts` — 34 passed
- `npx vitest run apps/api/src/delivery/` — 15 passed
- `pnpm --filter @photoreport/api typecheck` — clean
Paperclip-Issue: BIT-33558
The ensureCloudM19Target and ensureCloudW17Target calls fire concurrently
at worker startup. During a deploy overlap (two workers live briefly), the
Postgres server hits max_connections and these one-shot queries get P2037.
The .catch() handler logged at warn with the raw error, which triggered
the reporter's logHooks and paged the error loop.
Follow the same pattern as develop/sports/archive workers: check
isPrismaTooManyConnections and log at info (below the reporter's warn
threshold) so the error loop stays quiet. The targets retry on the next
worker restart.
Also add tests for isPrismaTooManyConnections covering the P2037 code,
the bare message, the P2010/53300 raw-query variant, and negative cases.
Paperclip-Issue: BIT-33558
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The
ensureCloudM19TargetandensureCloudW17Targetcalls fire concurrently at worker startup. During a deploy overlap (two workers live briefly), the Postgres server hitsmax_connectionsand these one-shot queries get P2037.The
.catch()handler logged atwarnwith the raw error, which triggered the reporterlogHooksand paged the error loop.Fix
Follow the same pattern as
develop,sports, andarchiveworkers: checkisPrismaTooManyConnectionsand log atinfo(below the reporter warn threshold) so the error loop stays quiet. The targets retry on the next worker restart.Also adds tests for
isPrismaTooManyConnectionscovering the P2037 code, bare message, P2010/53300 raw-query variant, and negative cases.Testing
npx vitest run apps/api/src/lib/pg.test.ts— 34 passednpx vitest run apps/api/src/delivery/— 15 passedpnpm --filter @photoreport/api typecheck— cleanPaperclip-Issue: BIT-33558
auto-approve: CI success on
baa22f7ea0(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
baa22f7ea0(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
baa22f7ea0(gitea_auto_approve_open_prs_once.py)