zedkit
@zedtech/zedkit-server

Retry transient Postgres failures

Map serialization/deadlock/connection errors to retry without duplicating SQLSTATE lists.

beta

At a glance

  • Who: Workers and job runners using @zedtech/zedkit-core backoff 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 pgErrorCode and your API error model.
  • See also: Tell a Postgres conflict from a bug

Install

pnpm add @zedtech/zedkit-server

Latest: 0.2.1 (via changesets).

Example

Usage
import { pgErrorRetryable } from "@zedtech/zedkit-server";
import { computeBackoffMs } from "@zedtech/zedkit-server";

if (pgErrorRetryable(error) === true) {
  await sleep(computeBackoffMs(attempt));
  continue;
}

Wraps: (none)

On this page