Scheduler (and of BotConfig.scheduler). They only affect
durable tasks — plain schedule/every/delay(spec, fn) tasks stay in-memory.
Properties
store?
schedules() of SQLiteStore, RedisStore, PostgresStore, MysqlStore
or MongoStore (or any implementation).
lease?
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?
tickMs?
'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?
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?
Date.now.
Returns
number
timeZone?
'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.