interface DistributedLockOptions

Options for distributed locking.

Properties

optional
enabled: boolean

Enable distributed locking. Default false.

optional
storage: "redis"

Lock backend. Only 'redis' is supported when enabled: true.

optional
url: string

Redis connection URL. Default 'redis://localhost:6379'.

Injected ioredis-compatible client (preferred over lazy load).

Custom lock implementation. Takes priority over storage when present.

optional
ttlMs: number

Lock TTL in milliseconds. Must exceed the job's worst-case runtime.

Bounds TWO distinct guarantees (M70l C3): how long the per-handler OVERLAP mutex lives after a holder dies without releasing, and how long a claimed fire SLOT is remembered before a late replica may re-run it — slot locks are never released, so this value is the replica-skew window. A value below the maximum skew between replicas lets a slow replica re-run an already-claimed fire.

Usage

import { type DistributedLockOptions } from "scheduler-plugin/src/index.ts";