Postgres terminates a pooled client mid-query on restart or pg_terminate_backend (SQLSTATE 57P01); Prisma surfaces the raw-query failure as P2010 wrapping "terminating connection due to administrator command".
linkStoredSquads ran an unguarded $queryRaw, so the rejection escaped to SportsWorker.fillRegister's catch and logged warn ("sports: register not filled"), paging the error loop for a transient blip (BIT-32471, ERRCLUSTER 498b9b73d09c).
Fix
Wrap the $queryRaw (extracted into linkStoredSquadsRows) so an admin-shutdown is detected via isPostgresAdminShutdown, logged at info, and returns 0 — fillRegister's loop breaks and the next scheduled tick retries on a fresh client. Non-transient errors still rethrow. The same helper already covers the equivalent raw-query path (BIT-32448/32449).
Tests
linkStoredSquads logs at info and returns 0 when the raw query is terminated mid-flight (57P01).
linkStoredSquads still rethrows a non-transient raw-query error.
Postgres terminates a pooled client mid-query on restart or `pg_terminate_backend` (SQLSTATE 57P01); Prisma surfaces the raw-query failure as P2010 wrapping "terminating connection due to administrator command".
`linkStoredSquads` ran an unguarded `$queryRaw`, so the rejection escaped to `SportsWorker.fillRegister`'s catch and logged `warn` ("sports: register not filled"), paging the error loop for a transient blip (BIT-32471, ERRCLUSTER 498b9b73d09c).
## Fix
Wrap the `$queryRaw` (extracted into `linkStoredSquadsRows`) so an admin-shutdown is detected via `isPostgresAdminShutdown`, logged at info, and returns 0 — `fillRegister`'s loop breaks and the next scheduled tick retries on a fresh client. Non-transient errors still rethrow. The same helper already covers the equivalent raw-query path (BIT-32448/32449).
## Tests
- `linkStoredSquads` logs at info and returns 0 when the raw query is terminated mid-flight (57P01).
- `linkStoredSquads` still rethrows a non-transient raw-query error.
- Existing `pg.test.ts` / `service.test.ts` suites pass (23 tests).
Paperclip-Issue: BIT-32471
Postgres terminates a pooled client mid-query on restart or
`pg_terminate_backend` (SQLSTATE 57P01); Prisma surfaces the raw-query
failure as P2010 wrapping "terminating connection due to administrator
command". linkStoredSquads runs an unguarded `$queryRaw`, so the rejection
escaped to SportsWorker.fillRegister's catch and logged `warn` ("sports:
register not filled"), paging the error loop for a transient blip.
Wrap the `$queryRaw` (extracted into linkStoredSquadsRows) so an
admin-shutdown is detected via isPostgresAdminShutdown, logged at info, and
returns 0 — fillRegister's loop breaks and the next scheduled tick retries
on a fresh client. Non-transient errors still rethrow. The same helper
already covers the equivalent raw-query path (BIT-32448/32449).
Paperclip-Issue: BIT-32471
spark
merged commit 238f4cad1f into main2026-11-18 21:40:03 +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.
Postgres terminates a pooled client mid-query on restart or
pg_terminate_backend(SQLSTATE 57P01); Prisma surfaces the raw-query failure as P2010 wrapping "terminating connection due to administrator command".linkStoredSquadsran an unguarded$queryRaw, so the rejection escaped toSportsWorker.fillRegister's catch and loggedwarn("sports: register not filled"), paging the error loop for a transient blip (BIT-32471, ERRCLUSTER 498b9b73d09c).Fix
Wrap the
$queryRaw(extracted intolinkStoredSquadsRows) so an admin-shutdown is detected viaisPostgresAdminShutdown, logged at info, and returns 0 —fillRegister's loop breaks and the next scheduled tick retries on a fresh client. Non-transient errors still rethrow. The same helper already covers the equivalent raw-query path (BIT-32448/32449).Tests
linkStoredSquadslogs at info and returns 0 when the raw query is terminated mid-flight (57P01).linkStoredSquadsstill rethrows a non-transient raw-query error.pg.test.ts/service.test.tssuites pass (23 tests).Paperclip-Issue: BIT-32471
Postgres terminates a pooled client mid-query on restart or `pg_terminate_backend` (SQLSTATE 57P01); Prisma surfaces the raw-query failure as P2010 wrapping "terminating connection due to administrator command". linkStoredSquads runs an unguarded `$queryRaw`, so the rejection escaped to SportsWorker.fillRegister's catch and logged `warn` ("sports: register not filled"), paging the error loop for a transient blip. Wrap the `$queryRaw` (extracted into linkStoredSquadsRows) so an admin-shutdown is detected via isPostgresAdminShutdown, logged at info, and returns 0 — fillRegister's loop breaks and the next scheduled tick retries on a fresh client. Non-transient errors still rethrow. The same helper already covers the equivalent raw-query path (BIT-32448/32449). Paperclip-Issue: BIT-32471