Top-level engine supervisor. Started by the host (Oban-style) as
{GenDurable, opts} in their own supervision tree.
Options
:name— the instance identity (an atom, defaultGenDurable). Everything an instance owns — its supervisor registration, task supervisor, config entry, FSM registry — is keyed by it, so several engines (e.g. different repos, or disjoint queue sets) coexist; address API calls withname:. Starting two instances with the same name fails with:already_started.:repo— the host'sEcto.Repo(required).:fsms— FSM modules to register explicitly (default[]). Only needed for a custom:nameor to keep an old:versionrunning; otherwise a machine is resolved from thefsmcolumn (its module name). SeeGenDurable.Registry.:queues— keyword list ofqueue_name => concurrency(default[default: 10]).[]runs no schedulers — this node only inserts/signals (see the topologies section of the operations guide).:lease_ttl,:heartbeat_interval,:poll_interval— timings in ms (balanced defaults: 60_000 / 20_000 / 1_000).:reaper— the lease-reclamation sweeper:[interval: 30_000](ms), orfalseto not run one on this node.:gc— the retention/maintenance sweeper:[interval: 60_000, retention: 86_400_000, batch: 10_000](ms between sweeps; ms adone/failedrow is kept after it terminates; max rows deleted per sweep), orfalseto not run one on this node.:poke— how an insert announces new work to schedulers (seeGenDurable.Poke)::local(default) — the caller's node only;:cluster— every node, over Erlang distribution;{:redis, url_or_opts}— Redis Pub/Sub, for clusters without distribution (requires the optional:redixdependency; the value is passed toRedix.start_link/1). Best-effort in every mode — the poll interval is the discovery floor.:await— tuning forGenDurable.await/3:[tick: 25](ms between the batched watcher's probes — the latency granularity for results committed on OTHER nodes; same-node results are pushed instantly). Idle-free, so there is nofalse.
reaper: false / gc: false are per-node knobs for topology (a web-only
or worker-only node), not switches you may flip everywhere: the cluster needs
at least one node running each, or expired leases are never reclaimed and
terminal rows / stale limiter counters accumulate forever. Running them on
several nodes is safe (sweeps claim via ordered SKIP LOCKED), just
redundant.
:prefetch— extra rows each queue claims and buffers beyond its running slots (default0⇒ no over-fetch). SeeGenDurable.Scheduler.:min_demand— batch gate for the picker (default1).:max_poll_interval— idle-backoff ceiling in ms (default5_000).:drain_timeout— on shutdown, how long (ms) each queue waits for its in-flight steps to finish before giving up to the reaper (default5_000). Buffered (un-started) rows are released immediately regardless.:rate_limits— named token-bucket rate limits (default[]), e.g.[stripe: [allowed: 100, period: {1, :minute}], emails: [allowed: 5, period: 60, burst: 10, shards: 4]].allowed/periodset the sustained rate;burst(defaultallowed) the capacity.shards(default 1) splits rate/burst across bucket rows so concurrent (cross-node) pickers grab disjoint shards instead of serializing — size it to the number of nodes that contend the hottest key. A step opts into a limit by returningrate_limit: :stripe(or{:stripe, key}).:concurrency_limits— named concurrency caps forconcurrency_key(default[]), e.g.[stripe: [limit: 1000, shards: 10]]: at mostlimitconcurrent executions per key whose name matches (concurrency_key: {:stripe, tenant}⇒ key"stripe:tenant", name"stripe"). An unconfigured key keeps the default limit of 1 (mutual exclusion).shards(default 1, clamped tolimit) splits the cap across bucket rows so cross-node pickers take disjoint shards and completions credit back per shard — sizeshards ≥ contending nodes. Careful: a config name captures every key with that prefix — configuring a name that collides with identity-style keys (e.g.order:used for mutual exclusion) silently raises their limit and breaks the exclusion.
:prefetch, :min_demand, and :max_poll_interval are the feeder
aggressiveness knobs and apply to every queue; see GenDurable.Scheduler for
the trade-offs (DB chatter vs. latency vs. cross-node fairness).
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.