Skip to main content
Defined in: scheduler/ScheduleStore.ts:117 Options of a Scheduler (and of BotConfig.scheduler). They only affect durable tasks — plain schedule/every/delay(spec, fn) tasks stay in-memory.

Properties

store?

Defined in: scheduler/ScheduleStore.ts:124 Where durable tasks persist their state. Default: an in-memory store, which keeps the in-process semantics (nothing survives a restart; a warning is logged once). Use the schedules() of SQLiteStore, RedisStore, PostgresStore, MysqlStore or MongoStore (or any implementation).

lease?

Defined in: scheduler/ScheduleStore.ts:136 Optional leadership, which saves store round-trips with many replicas: the replica holding the scheduler:leader lease claims occurrences on time; the others only claim one left overdue for leaderTtlMs (a task only they registered, or a dead leader). Correctness never depends on it: per-occurrence claims are fenced anyway. Either a fenced LeaseProvider (MemoryLeaseProvider, RedisStore#leases()) or a multi-replica Coordinator (RedisCoordinator, MemoryCoordinator), whose tryLead leadership is used. A bot with BotConfig.coordination defaults to its coordinator here.

owner?

Defined in: scheduler/ScheduleStore.ts:138 This process’s lease-owner id. Default: a random id per scheduler.

tickMs?

Defined in: scheduler/ScheduleStore.ts:145 Poll period for durable tasks (duration or ms, default '1s'): picks up occurrences whose runner crashed (once its lease expires) and retries after store errors. It is also the grace period (plus twice leaderTtlMs with a lease): a slot claimed later than that after it fell due counts as missed (no replica ran it in time).

leaderTtlMs?

Defined in: scheduler/ScheduleStore.ts:152 TTL of the scheduler:leader lease when lease is set (duration or ms, default '30s'). With a Coordinator lease the coordinator renews the leadership itself; this is then only the follower’s grace before it steps in (default: the coordinator’s leaseMs when it exposes one, else '30s').

now?

Defined in: scheduler/ScheduleStore.ts:154 Clock used for durable tasks (epoch ms). For tests; default Date.now.

Returns

number

timeZone?

Defined in: scheduler/ScheduleStore.ts:162 Default IANA zone ('America/Bogota', 'Europe/Madrid', 'UTC', or 'local') the cron fields of this scheduler’s cron tasks are read in, plain and durable alike; a task’s own timeZone overrides it. Default: the process zone (today’s behaviour). Validated at construction (RangeError for an unknown zone). See CronTaskOptions.timeZone for the daylight-saving rules.