basalt / scheduler/src / ReconcilerOptions
Interface: ReconcilerOptions<T>
Defined in: scheduler/src/reconciler.ts:39
Type Parameters
T
T
Properties
every
> every: DurationInput
Defined in: scheduler/src/reconciler.ts:47
Cadence: a duration the minute-based scheduler can express — whole minutes dividing 60 ('1m', '5m', '15m'), whole hours dividing 24 ('2h') or '1d' — or a raw 5-field cron expression ('*/10 * * * *').
find
> find: () => T[] | Promise<T[]>
Defined in: scheduler/src/reconciler.ts:49
Returns the stuck items. Keep it bounded (a take) — maxPerRun only caps the work, not the query.
Returns
T[] | Promise<T[]>
hooks?
> optional hooks?: HookBus
Defined in: scheduler/src/reconciler.ts:66
Hook bus on which reconciler:run is emitted. Default: the app's bus when scheduled on the schedulerPlugin's scheduler.
lock?
> optional lock?: ReconcilerLock
Defined in: scheduler/src/reconciler.ts:73
Distributed mutex held for the whole run, so two replicas never reconcile at the same time even when a run outlasts the cadence. Optional: without it the in-process guard still applies, and a scheduler with a lock already runs the entry on one replica per tick (.onOneServer()).
lockTtlMs?
> optional lockTtlMs?: number
Defined in: scheduler/src/reconciler.ts:75
TTL of the run lock (lease) — must exceed the longest run. Default 15 minutes.
maxPerRun?
> optional maxPerRun?: number
Defined in: scheduler/src/reconciler.ts:53
Most items re-dispatched per run; the rest wait for the next run. Default 100.
name
> name: string
Defined in: scheduler/src/reconciler.ts:41
Unique name — used in the schedule entry (reconciler:<name>), lock key, hook payload and logs.
onError?
> optional onError?: (error, item) => void
Defined in: scheduler/src/reconciler.ts:59
An item's redispatch threw (item set) or find threw (item undefined). Default: console.error — a stuck item that can't be recovered must never be silent. Must not throw.
Parameters
error
unknown
item
T | undefined
Returns
void
onOneServer?
> optional onOneServer?: boolean
Defined in: scheduler/src/reconciler.ts:82
Run on one replica per tick when the scheduler has a lock. Default true; ignored when the scheduler has no lock (in-process guard only).
onRun?
> optional onRun?: (result) => void
Defined in: scheduler/src/reconciler.ts:61
Called after every run (also skipped ones) with its counts — for metrics.
Parameters
result
Returns
void
redispatch
> redispatch: (item) => void | Promise<void>
Defined in: scheduler/src/reconciler.ts:51
Re-dispatches one item. Must be idempotent. A throw is isolated to that item.
Parameters
item
T
Returns
void | Promise<void>
timezone?
> optional timezone?: string
Defined in: scheduler/src/reconciler.ts:77
Timezone for cron cadences. Default 'UTC'.