> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# SchedulerOptions

> Interface exported by @botmesh/core.

Defined in: [scheduler/ScheduleStore.ts:117](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L117)

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?

```ts theme={null}
store?: ScheduleStore;
```

Defined in: [scheduler/ScheduleStore.ts:124](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L124)

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?

```ts theme={null}
lease?: SchedulerLease;
```

Defined in: [scheduler/ScheduleStore.ts:136](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L136)

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](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider.md) (`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?

```ts theme={null}
owner?: string;
```

Defined in: [scheduler/ScheduleStore.ts:138](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L138)

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

***

### tickMs?

```ts theme={null}
tickMs?: string | number;
```

Defined in: [scheduler/ScheduleStore.ts:145](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L145)

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?

```ts theme={null}
leaderTtlMs?: string | number;
```

Defined in: [scheduler/ScheduleStore.ts:152](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L152)

TTL of the `scheduler:leader` lease when [lease](#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?

```ts theme={null}
now?: () => number;
```

Defined in: [scheduler/ScheduleStore.ts:154](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L154)

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

#### Returns

`number`

***

### timeZone?

```ts theme={null}
timeZone?: string;
```

Defined in: [scheduler/ScheduleStore.ts:162](https://github.com/andresayac/botmesh/blob/main/packages/core/src/scheduler/ScheduleStore.ts#L162)

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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.