3 months ago
5295760A 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