Workhorse
Producing work

Keyed throttle

Accept one equivalent job during a busy window and coalesce later triggers into it.

Throttle keeps an acceptance window in PostgreSQL. The first request creates a job; an equivalent request before the window closes returns the same identity with a coalesced outcome.

const result = await queue.enqueueWithResult("email.digest", { accountId }, {
  throttle: { key: accountId, scope: "digest", windowMs: digestWindowMs },
});

The retained job may be waiting, active, or finished. Execution state does not reopen the acceptance window. A changed payload, queue, priority, schedule, retry policy, or window conflicts because silently discarding changed work would hide caller intent.

After the window closes, the key can accept a new job. One request cannot combine throttle with idempotency, debounce, or dependencies. The dashboard shows a safe key digest, the window, and the number of absorbed requests without exposing the raw key.

If the retained job depends on earlier work, prerequisiteJobId continues to identify that dependency while the throttle key controls repeated acceptance.

Next


Exact throttle outcomes, limits, and lifecycle events: architecture reference.

On this page