Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

fix(worker,db): handle pg-boss error events + drop redundant run_actions index

3 months ago

5295760
Authored
grim7/24/2026, 5:28:03 AM
A transient Postgres read-only window (PlanetScale failover, code 25006)
crash-looped the worker: pg-boss emits an EventEmitter 'error' with no
listener, so Node rethrows it as ERR_UNHANDLED_ERROR and the process exits
(observed: 9 restarts in 2 minutes). createBoss now always attaches a
boss.on('error') handler so both the worker and api heads log the blip and
ride out the failover instead of crashing; recovery is automatic once the DB
returns to read-write.

Also drops run_actions_run_idx (run_id) — fully redundant with the
run_actions_idempotency_unique (run_id, idempotency_key) left prefix. One
fewer index to maintain on the hot record→execute write path. Applied via
the normal migrate.ts deploy path (migration 0018).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Parentafbde34

6 files changed
  • apps/worker/src/index.ts+1−1
  • packages/db/drizzle/0018_past_peter_quill.sql+1−0
  • packages/db/drizzle/meta/0018_snapshot.json+2819−0
  • packages/db/drizzle/meta/_journal.json+7−0
  • packages/db/src/queue.ts+21−0
  • packages/db/src/schema/runs.ts+3−1