@zedtech/zedkit-server
Retry transient Postgres failures
Map serialization/deadlock/connection errors to retry without duplicating SQLSTATE lists.
beta
Usage
At a glance
- Who: Workers and job runners using
@zedtech/zedkit-corebackoff helpers. - What: Map serialization/deadlock/connection errors to retry without duplicating SQLSTATE lists.
- Use when: After a failed query in a retry loop.
- Avoid when: For HTTP mapping — use
pgErrorCodeand your API error model. - See also: Tell a Postgres conflict from a bug
Install
pnpm add @zedtech/zedkit-serverLatest: 0.2.1 (via changesets).
Example
import { pgErrorRetryable } from "@zedtech/zedkit-server";
import { computeBackoffMs } from "@zedtech/zedkit-server";
if (pgErrorRetryable(error) === true) {
await sleep(computeBackoffMs(attempt));
continue;
}Wraps: (none)