Setu-TS
    Preparing search index...

    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.

    // wrangler.toml: [triggers] crons = ["0 * * * *"]
    const cron = new WorkersCron({ logger });
    cron.on('0 * * * *', async () => {
    await app.services.get<IQueue>(CAPABILITIES.QUEUE).add('rebuild-report', {});
    });

    export default { fetch: app.fetch, scheduled: createScheduledHandler(cron) };

    0.2.0

    Index
    • 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.

      Parameters

      Returns Promise<void>

      Resolves once every handler for the expression has settled, when none rejected and the expression had at least one handler

      When any handler rejected, after all have settled

      When no handler is registered for controller.cron

    • 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.

      Returns readonly string[]

      The registered expressions, in registration order

    • 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.

      Parameters

      • expression: string

        The cron expression, exactly as configured

      • handler: CronHandler

        Invoked when that trigger fires

      Returns this

      This registry, for chaining