basalt / scheduler/src / ScheduleEntry
Class: ScheduleEntry
Defined in: scheduler/src/index.ts:77
A scheduled entry, built fluently:
schedule.job(ReconcileBilling).daily().at('03:00').timezone('UTC') schedule.call('purge-cache', () => cache.flush()).everyMinute().withoutOverlapping()
An entry has exactly ONE frequency (everyMinute, everyMinutes, hourly, daily, weekly, monthly, cron); a second one throws ScheduleDefinitionError instead of silently replacing the first.
Constructors
Constructor
> new ScheduleEntry(name, task): ScheduleEntry
Defined in: scheduler/src/index.ts:94
Parameters
name
string
task
Task
Returns
ScheduleEntry
Properties
name
> readonly name: string
Defined in: scheduler/src/index.ts:95
skippedOverlaps
> skippedOverlaps: number = 0
Defined in: scheduler/src/index.ts:92
count of executions skipped due to overlap — visible for observability/tests
Methods
at()
> at(time): this
Defined in: scheduler/src/index.ts:128
'HH:mm' (or 'H:mm') time. Combines with daily/weekly/monthly, or with no frequency; throws after everyMinute/everyMinutes/hourly/cron and when called twice.
Parameters
time
string
Returns
this
cron()
> cron(expression): this
Defined in: scheduler/src/index.ts:154
Raw cron expression (5 fields) — escape hatch. It is the entry's frequency.
Parameters
expression
string
Returns
this
daily()
> daily(): this
Defined in: scheduler/src/index.ts:111
Returns
this
describe()
> describe(): object
Defined in: scheduler/src/index.ts:200
Entry description — consumed by basalt schedule list.
Returns
object
cron
> cron: string
name
> name: string
timezone
> timezone: string
everyMinute()
> everyMinute(): this
Defined in: scheduler/src/index.ts:99
Returns
this
everyMinutes()
> everyMinutes(n): this
Defined in: scheduler/src/index.ts:103
Parameters
n
number
Returns
this
fridays()
> fridays(): this
Defined in: scheduler/src/index.ts:163
Returns
this
hourly()
> hourly(): this
Defined in: scheduler/src/index.ts:107
Returns
this
isDue()
> isDue(date): boolean
Defined in: scheduler/src/index.ts:204
Parameters
date
Date
Returns
boolean
mondays()
> mondays(): this
Defined in: scheduler/src/index.ts:159
Returns
this
monthly()
> monthly(): this
Defined in: scheduler/src/index.ts:119
Returns
this
onFailure()
> onFailure(handler): this
Defined in: scheduler/src/index.ts:194
Parameters
handler
(error) => void
Returns
this
onOneServer()
> onOneServer(): this
Defined in: scheduler/src/index.ts:184
On a horizontally-scaled deployment, run this entry on ONE replica per tick instead of on every pod. Requires a lock on the Scheduler (see ScheduleLock) — without one, boot fails loud rather than silently running the job N times. runNow()/schedule:run bypass the lock (a manual trigger is deliberate).
Returns
this
saturdays()
> saturdays(): this
Defined in: scheduler/src/index.ts:164
Returns
this
sundays()
> sundays(): this
Defined in: scheduler/src/index.ts:158
Returns
this
thursdays()
> thursdays(): this
Defined in: scheduler/src/index.ts:162
Returns
this
timezone()
> timezone(tz): this
Defined in: scheduler/src/index.ts:166
Parameters
tz
string
Returns
this
tuesdays()
> tuesdays(): this
Defined in: scheduler/src/index.ts:160
Returns
this
wednesdays()
> wednesdays(): this
Defined in: scheduler/src/index.ts:161
Returns
this
weekly()
> weekly(): this
Defined in: scheduler/src/index.ts:115
Returns
this
withoutOverlapping()
> withoutOverlapping(): this
Defined in: scheduler/src/index.ts:172
If the previous execution is still running, the new one is skipped.
Returns
this