@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Interface SchedulerOptions

    Options of a Scheduler (and of BotConfig.scheduler). They only affect durable tasks — plain schedule/every/delay(spec, fn) tasks stay in-memory.

    interface SchedulerOptions {
        store?: ScheduleStore;
        lease?: SchedulerLease;
        owner?: string;
        tickMs?: string | number;
        leaderTtlMs?: string | number;
        now?: () => number;
        timeZone?: string;
    }
    Index

    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).

    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?: string

    This process's lease-owner id. Default: a random id per scheduler.

    tickMs?: string | number

    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?: string | number

    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?: () => number

    Clock used for durable tasks (epoch ms). For tests; default Date.now.

    timeZone?: string

    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.