Skip to content

cron

Source: src/Cloudflare/Workers/CronEventSource.ts

Subscribe to Cloudflare Cron Triggers with an Effect handler.

This wires both pieces of a scheduled Worker:

  • Runtime: registers a scheduled listener on the Worker.
  • Deploy-time: attaches the cron expression to the host Worker.
yield* Cloudflare.cron("0 12 * * *").subscribe((controller) =>
Effect.log(`scheduled at ${controller.scheduledTime}`),
);