A Postgres restart or pg_terminate_backend (error 57P01) kills the pooled client mid-prisma.$queryRaw in FaceWorker.claimWhere (apps/api/src/faces/service.ts:116). Prisma surfaces it as P2010 wrapping the server message terminating connection due to administrator command.
The next tick re-claims a fresh client, so this is a transient blip. It was logged at warn (faces: poll failed), which paged the error loop (BIT-32450). Now it is downgraded to info (faces: poll skipped, db connection was reset) and the loop continues.
How
Reuses the shared isPostgresAdminShutdown helper from apps/api/src/lib/pg.ts (introduced for the autopilot and develop workers in BIT-32448 / BIT-32449) and applies the same info/warn split in the FaceWorker tick catch block.
Stacked on top of fix/BIT-32449-develop-pg-admin-shutdown (which adds lib/pg.ts); once that PR merges, this one auto-collapses to just the faces changes.
Tests
isPostgresAdminShutdown matches the real 57P01 raw-query message and rejects unrelated errors.
FaceWorker logs a 57P01 shutdown at info (not warn) and keeps looping.
## What
A Postgres restart or `pg_terminate_backend` (error 57P01) kills the pooled client mid-`prisma.$queryRaw` in `FaceWorker.claimWhere` (`apps/api/src/faces/service.ts:116`). Prisma surfaces it as `P2010` wrapping the server message `terminating connection due to administrator command`.
The next tick re-claims a fresh client, so this is a transient blip. It was logged at `warn` (`faces: poll failed`), which paged the error loop (BIT-32450). Now it is downgraded to `info` (`faces: poll skipped, db connection was reset`) and the loop continues.
## How
Reuses the shared `isPostgresAdminShutdown` helper from `apps/api/src/lib/pg.ts` (introduced for the autopilot and develop workers in BIT-32448 / BIT-32449) and applies the same info/warn split in the `FaceWorker` tick catch block.
Stacked on top of `fix/BIT-32449-develop-pg-admin-shutdown` (which adds `lib/pg.ts`); once that PR merges, this one auto-collapses to just the faces changes.
## Tests
- `isPostgresAdminShutdown` matches the real 57P01 raw-query message and rejects unrelated errors.
- `FaceWorker` logs a 57P01 shutdown at `info` (not `warn`) and keeps looping.
- A real poll failure still warns.
`pnpm --filter @photoreport/api vitest run --config vitest.unit.config.ts src/faces/` → 6 passed.
Paperclip-Issue: BIT-32450
Paperclip-Cluster: b23ce9fba31c
A Postgres restart or `pg_terminate_backend` (error 57P01) takes the render worker's pooled client mid-`$queryRaw` in `DevelopService.claimRenders`. Prisma surfaces it as P2010 wrapping the server message, and the catch in `RenderWorker.start` logged it at warn as "develop: poll failed" — which fed the error loop on every tick during a DB restart. The next tick re-claims a fresh client, so this is a transient blip: detect 57P01 and log at info instead, keeping the warn path for real poll failures. Extract `isPostgresAdminShutdown` into `lib/pg.ts` so develop and autopilot share one definition.
Paperclip-Issue: BIT-32449
Paperclip-Cluster: 8d12f6208533
A Postgres restart or pg_terminate_backend (error 57P01) kills the pooled
client mid-`prisma.` in FaceWorker.claimWhere. Prisma surfaces it
as P2010 wrapping the server message. The next tick re-claims a fresh
client, so this is a transient blip: log it at info and keep looping instead
of warning, which was paging the error loop.
Reuses the shared isPostgresAdminShutdown helper from lib/pg.js (introduced
for the autopilot and develop workers in BIT-32448/BIT-32449).
spark
merged commit 444c1e492a into main2026-11-18 18:14:32 +00:00
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.
What
A Postgres restart or
pg_terminate_backend(error 57P01) kills the pooled client mid-prisma.$queryRawinFaceWorker.claimWhere(apps/api/src/faces/service.ts:116). Prisma surfaces it asP2010wrapping the server messageterminating connection due to administrator command.The next tick re-claims a fresh client, so this is a transient blip. It was logged at
warn(faces: poll failed), which paged the error loop (BIT-32450). Now it is downgraded toinfo(faces: poll skipped, db connection was reset) and the loop continues.How
Reuses the shared
isPostgresAdminShutdownhelper fromapps/api/src/lib/pg.ts(introduced for the autopilot and develop workers in BIT-32448 / BIT-32449) and applies the same info/warn split in theFaceWorkertick catch block.Stacked on top of
fix/BIT-32449-develop-pg-admin-shutdown(which addslib/pg.ts); once that PR merges, this one auto-collapses to just the faces changes.Tests
isPostgresAdminShutdownmatches the real 57P01 raw-query message and rejects unrelated errors.FaceWorkerlogs a 57P01 shutdown atinfo(notwarn) and keeps looping.pnpm --filter @photoreport/api vitest run --config vitest.unit.config.ts src/faces/→ 6 passed.Paperclip-Issue: BIT-32450
Paperclip-Cluster: b23ce9fba31c