A Postgres restart or a downed route makes the database unreachable (Prisma P1001: "Can't reach database server at 127.0.0.1:5432") mid-syncEventSquads. The liga squad re-read catch logged it at warn ("liga squad re-read failed"), paging the error loop for a transient blip — and uncaught P1001 from the initial findUnique or the second squad loop propagated to the caller's warn too.
Fix
Detect P1001 with the shared isPrismaServerUnreachable helper (lib/pg.ts, added in BIT-32462 for the archive worker) and log at info instead:
Liga re-read catch (syncEventSquadsNow): on P1001, log info and return result early — every remaining query would fail the same way.
syncEventSquads wrapper: catch P1001 from retryOnConnectionClosed and return zeros with an info log.
The next scheduled sync retries once the server is back. Same pattern as archive/faces/develop/autopilot (BIT-32448/32449/32450/32462).
Tests
3 new tests in apps/api/src/sports/service.test.ts:
P1001 in the initial event.findUnique → info log, zeros returned, no warn.
P1001 in savePlayers during the liga re-read → info log, zeros returned, no warn, second loop's findMany not called.
Non-P1001 error in the liga re-read → still warns.
Paperclip-Issue: BIT-32463
## What
A Postgres restart or a downed route makes the database unreachable (Prisma **P1001**: "Can't reach database server at 127.0.0.1:5432") mid-`syncEventSquads`. The liga squad re-read catch logged it at `warn` ("liga squad re-read failed"), paging the error loop for a transient blip — and uncaught P1001 from the initial `findUnique` or the second squad loop propagated to the caller's `warn` too.
## Fix
Detect P1001 with the shared `isPrismaServerUnreachable` helper (lib/pg.ts, added in BIT-32462 for the archive worker) and log at `info` instead:
- **Liga re-read catch** (`syncEventSquadsNow`): on P1001, log info and `return result` early — every remaining query would fail the same way.
- **`syncEventSquads` wrapper**: catch P1001 from `retryOnConnectionClosed` and return zeros with an info log.
The next scheduled sync retries once the server is back. Same pattern as archive/faces/develop/autopilot (BIT-32448/32449/32450/32462).
## Tests
3 new tests in `apps/api/src/sports/service.test.ts`:
- P1001 in the initial `event.findUnique` → info log, zeros returned, no warn.
- P1001 in `savePlayers` during the liga re-read → info log, zeros returned, no warn, second loop's `findMany` not called.
- Non-P1001 error in the liga re-read → still warns.
Paperclip-Issue: BIT-32463
A Postgres restart or a downed route makes the database unreachable
(Prisma P1001: "Can't reach database server at <host>:<port>") mid
syncEventSquads — inside savePlayers' findMany during the liga squad
re-read, or at the initial event findUnique, or in the second squad
loop. The liga re-read catch logged it at warn ("liga squad re-read
failed"), paging the error loop for a transient blip, and the outer
syncEventSquads let uncaught P1001 propagate to the caller's warn.
Detect P1001 with the shared isPrismaServerUnreachable helper
(lib/pg.ts, added in BIT-32462 for the archive worker) and log at
info instead: in the liga re-read catch, return the partial result
early; in the syncEventSquads wrapper, catch P1001 from
retryOnConnectionClosed and return zeros. The next scheduled sync
retries once the server is back. Same pattern as archive/faces/
develop/autopilot (BIT-32448/32449/32450/32462).
Paperclip-Issue: BIT-32463
spark
merged commit 16030b9249 into main2026-11-18 20:47:52 +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 a downed route makes the database unreachable (Prisma P1001: "Can't reach database server at 127.0.0.1:5432") mid-
syncEventSquads. The liga squad re-read catch logged it atwarn("liga squad re-read failed"), paging the error loop for a transient blip — and uncaught P1001 from the initialfindUniqueor the second squad loop propagated to the caller'swarntoo.Fix
Detect P1001 with the shared
isPrismaServerUnreachablehelper (lib/pg.ts, added in BIT-32462 for the archive worker) and log atinfoinstead:syncEventSquadsNow): on P1001, log info andreturn resultearly — every remaining query would fail the same way.syncEventSquadswrapper: catch P1001 fromretryOnConnectionClosedand return zeros with an info log.The next scheduled sync retries once the server is back. Same pattern as archive/faces/develop/autopilot (BIT-32448/32449/32450/32462).
Tests
3 new tests in
apps/api/src/sports/service.test.ts:event.findUnique→ info log, zeros returned, no warn.savePlayersduring the liga re-read → info log, zeros returned, no warn, second loop'sfindManynot called.Paperclip-Issue: BIT-32463
A Postgres restart or a downed route makes the database unreachable (Prisma P1001: "Can't reach database server at <host>:<port>") mid syncEventSquads — inside savePlayers' findMany during the liga squad re-read, or at the initial event findUnique, or in the second squad loop. The liga re-read catch logged it at warn ("liga squad re-read failed"), paging the error loop for a transient blip, and the outer syncEventSquads let uncaught P1001 propagate to the caller's warn. Detect P1001 with the shared isPrismaServerUnreachable helper (lib/pg.ts, added in BIT-32462 for the archive worker) and log at info instead: in the liga re-read catch, return the partial result early; in the syncEventSquads wrapper, catch P1001 from retryOnConnectionClosed and return zeros. The next scheduled sync retries once the server is back. Same pattern as archive/faces/ develop/autopilot (BIT-32448/32449/32450/32462). Paperclip-Issue: BIT-32463