Skip to main content
Defined in: scheduler/ScheduleStore.ts:172 Reference, in-process ScheduleStore. Nothing survives the process.

Implements

Constructors

Constructor

Returns

MemoryScheduleStore

Methods

get()

Defined in: scheduler/ScheduleStore.ts:177

Parameters

Returns

Promise<ScheduleRecord | null>

Implementation of

ScheduleStore.get

register()

Defined in: scheduler/ScheduleStore.ts:182 Insert the task if absent. If it exists with the same kind and spec, keep it untouched (that is how a restart keeps its nextRunAt); if either differs, overwrite kind, spec and nextRunAt with the given ones (the fencing token is kept). Returns the stored record.

Parameters

Returns

Promise<ScheduleRecord>

Implementation of

ScheduleStore.register

claimDue()

Defined in: scheduler/ScheduleStore.ts:199 Atomic claim: succeeds only when nextRunAt !== null && nextRunAt <= now and the record has no live lease (leaseUntil absent or <= now). Then it sets leaseOwner = owner, leaseUntil = now + leaseMs and increments fencingToken. Returns null otherwise (not due, leased elsewhere, or unknown id).

Parameters

Returns

Promise<ClaimResult | null>

Implementation of

ScheduleStore.claimDue

renew()

Defined in: scheduler/ScheduleStore.ts:209 Set leaseUntil only if fencingToken still matches; false means the lease was lost.

Parameters

Returns

Promise<boolean>

Implementation of

ScheduleStore.renew

complete()

Defined in: scheduler/ScheduleStore.ts:216 Commit an occurrence only if fencingToken still matches: write the patch, clear the lease and set updatedAt = now. false when stale (claimed again since) or deleted.

Parameters

Returns

Promise<boolean>

Implementation of

ScheduleStore.complete

delete()

Defined in: scheduler/ScheduleStore.ts:225 Remove the record. The id’s fencing token is kept as a high-water mark: a later register() of the same id starts from it, so tokens never go backwards per id.

Parameters

Returns

Promise<void>

Implementation of

ScheduleStore.delete

list()

Defined in: scheduler/ScheduleStore.ts:232 Every stored record (orphans included), in no particular order.

Returns

Promise<ScheduleRecord[]>

Implementation of

ScheduleStore.list