BotConfig.scheduler.store). In memory by
default; SQLiteStore and RedisStore (among others) provide one through store.schedules().
Methods
start()?
Returns
Promise<void>
get()
Parameters
Returns
Promise<ScheduleRecord | null>
register()
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>
claimDue()
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>
renew()
leaseUntil only if fencingToken still matches; false means the lease was lost.
Parameters
Returns
Promise<boolean>
complete()
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>
delete()
register() of the same id starts from it, so tokens never go backwards per id.
Parameters
Returns
Promise<void>
list()
Returns
Promise<ScheduleRecord[]>