Docket.Postgres (docket v0.1.1)

Copy Markdown View Source

The complete PostgreSQL backend bundle for a durable Docket runtime.

Configure the bundle as the single durable substitution boundary. The application owns and supervises its Repo; Docket owns the dispatcher, claimed-run vehicles, optional LISTEN/NOTIFY fast path, and retention pruner:

use Docket,
  backend:
    {Docket.Postgres,
     repo: MyApp.Repo,
     pruner: [
       interval_ms: :timer.hours(1),
       event_retention_ms: :timer.hours(24 * 30),
       run_retention_ms: :timer.hours(24 * 90),
       batch_size: 1_000
     ]}

notifier: :none selects poll-only operation. Retention is deliberately explicit: starting the bundle without a complete :pruner policy fails instead of silently choosing when durable records are deleted.

:clock is a testing-only, instance-owned wall-clock seam. It requires testing: :inline or testing: :manual, is configured only at the top level, and cannot be replaced by individual calls. Production dispatch, execution, and retention use their authoritative default clocks.

Store modules are fixed by this bundle and are not public mix-and-match configuration. Public operations resolve tenant scope before calling the stores; only the supervised dispatcher and vehicles use :system scope.

Summary

Functions

Synchronously claims and drains due runs in the calling process.

Functions

drain_runs(context, opts)

Synchronously claims and drains due runs in the calling process.