A registry of Cron Trigger handlers, keyed by cron expression.
The key is the expression rather than a name of our choosing because that is
all the platform reports: ScheduledController.cron is the exact string from
wrangler.toml. Both lists must agree — an expression registered here
but absent from [triggers] crons never fires, and a trigger configured
there with nothing registered here is reported through the logger on every
occurrence. expressions exists so an application can assert its
own coverage.
WorkersCron(options?: WorkersCronOptions)
options: WorkersCronOptions
Logger for the unmatched-trigger and handler-failure paths
dispatch(controller: IScheduledController): Promise<void>
Runs every handler registered for the firing trigger's expression.
Handlers run to settlement — all of them are awaited even when some
reject, so one failing handler never abandons the others. After every
handler has settled, a rejection is REPORTED and then PROPAGATED as an
AggregateError, and a firing expression with no registered handler
throws: createScheduledHandler is a bare delegation, so the platform's
own response — counting the whole invocation as failed — becomes the
sink that needs no logger configuration (M70l X9-5). Breaking vs
earlier versions, where dispatch never rejected; an application that
wants the old fire-and-forget behaviour wraps its handlers in try.
expressions(): readonly string[]
Every expression that has at least one handler.
Intended for an application to check against its own wrangler.toml, since
nothing in the process can read that file.
on(expression: string,handler: CronHandler): this
Registers a handler for a cron expression.
Several handlers may share one expression; all of them run, and one that
rejects does not prevent the others. The expression is matched exactly
against ScheduledController.cron, so it must be written the same way it
appears in wrangler.toml.