Skip to content

Commit 9eec9e6

Browse files
authored
Added stronger callouts for ScheduledEvent listener (#366)
* Added an aside about Scheduled event Listeners Added an aside to create a stronger callout of this requirement that is easier to spot and reference than the background description. * Added note in background about cron triggers * Updated Desc language for accuracy and clarity * Forgot a period
1 parent a27aa0d commit 9eec9e6

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

products/workers/src/content/platform/cron-triggers/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Cron Triggers allow users to map a cron expression to a Worker script using a [S
1212

1313
Cron Triggers can be added to scripts with the Cloudflare API, or in the dashboard on a [Workers Triggers tab](https://dash.cloudflare.com/?to=/:account/workers) up to the [per-script limit](/platform/limits). If a script is managed with Wrangler, Cron Triggers should be exclusively managed through the **`wrangler.toml`** file.
1414

15+
<Aside header="Requires a ScheduledEvent Listener">
16+
17+
In order to respond to a Cron Trigger, a [ScheduledEvent](/runtime-apis/scheduled-event) listener must be added to the Workers script. Similar to the Fetch listener, add your code within the Scheduled listener to specify what the Worker should do under the condition that it was triggered by a Cron Trigger.
18+
19+
</Aside>
20+
1521
![workers-schedule-editor](./media/workers-schedule-editor.png)
1622

1723
## Supported cron expressions
@@ -67,4 +73,4 @@ Users can view the execution history of their Cron Triggers on the Past Events s
6773

6874
Note: it can take up to 30 minutes before events are displayed in Past Events when creating a new Worker or changing a Worker's name.
6975

70-
See [Metrics and Analytics](/learning/metrics-and-analytics) for more information.
76+
See [Metrics and Analytics](/learning/metrics-and-analytics) for more information.

products/workers/src/content/runtime-apis/scheduled-event.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Background
44

5-
The event type for Scheduled requests to a Worker. The `Object` passed through as `event` in [`addEventListener()`](/runtime-apis/add-event-listener).
5+
A ScheduledEvent is the event type for scheduled requests to a Worker. It is the `Object` passed through as the `event` when a Worker's `scheduled` [`addEventListener()`](/runtime-apis/add-event-listener) is invoked by a Worker's [Cron Trigger](/platform/cron-triggers).
6+
67

78
## Context
89

@@ -34,4 +35,4 @@ When a Workers script is invoked by a [Cron Trigger](/platform/cron-triggers), t
3435

3536
- Use this method to notify the runtime to wait for asynchronous tasks (e.g. logging, analytics to third-party services, streaming and caching). The first `event.waitUntil` to fail will be observed and recorded as the status in the [Cron Trigger](/platform/cron-triggers) Past Events table. Otherwise, it will be reported as a Success.
3637

37-
</Definitions>
38+
</Definitions>

0 commit comments

Comments
 (0)