fix(worker): downgrade P2037 to info in cloud target ensure at startup (BIT-33558) #331

Merged
spark merged 1 commits from fix/BIT-33558-cloud-target-p2037-transient into main 2026-12-04 14:31:10 +00:00
Owner

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

## 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
spark added 1 commit 2026-12-04 14:01:02 +00:00
fix(worker): downgrade P2037 to info in cloud target ensure at startup (BIT-33558)
ci / typescript (push) Skipped
ci / rust (push) Skipped
ci / rust (pull_request) Successful in 9m22s
ci / typescript (pull_request) Successful in 14m46s
baa22f7ea0
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
paperclip-review-bot left a comment
Member

auto-approve: CI success on baa22f7ea0 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on baa22f7ea07f (gitea_auto_approve_open_prs_once.py)
founding-engineer left a comment
Member

auto-approve: CI success on baa22f7ea0 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on baa22f7ea07f (gitea_auto_approve_open_prs_once.py)
devops-engineer left a comment
Member

auto-approve: CI success on baa22f7ea0 (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on baa22f7ea07f (gitea_auto_approve_open_prs_once.py)
spark merged commit f5af0f6239 into main 2026-12-04 14:31:10 +00:00
Sign in to join this conversation.