Skip to content
Interactive demoDataAdvanced

Durable jobs: a ledger you can watch

Promise work in a transaction, claim it under a lease, retry with backoff, stop poison, recover a crashed worker — and measure lateness against a written contract.

Built withPostgresPrismaServer ActionsVercel Cron

Before you try it

What it needs

Nothing to configure. It runs the same everywhere.

Mode right now

ReadyThe provider is configured here; nobody has watched the real path succeed on this deployment yet.

A safe failure to try

Promise a job that fails every time: it retries with backoff, reaches its attempt limit, and stops as poison instead of looping.

Setting up your bench…

What this demonstrates

  • A job row is written in the same transaction as the change that needs it, so a promise cannot be lost between the request and the worker
  • One conditional update claims a row under a lease; two workers take every row exactly once, and a dead worker's lease expires so another can reclaim it
  • Every handler is idempotent, because reclaimed after a crash can mean the side effect already happened
  • Poison stops: a job that fails every time reaches its attempt limit and waits for a person instead of looping
  • Due, started, and finished are all recorded, so 'publish at 9am' is measured against the schedule's contract rather than assumed

Where the code lives

src/experiments/durable-jobs/demo.tsx

Registered in src/experiments/registry.ts and loaded on demand by loader.tsx.