Skip to content

Commit 0ccf024

Browse files
authored
Update cron-triggers.mdx
1 parent 5253130 commit 0ccf024

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/content/docs/workers/configuration/cron-triggers.mdx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ Refer to the following additional examples to write your code:
7171

7272
### 2. Update configuration
7373

74+
:::note[Cron Trigger changes take time to propagate.]
75+
76+
Changes such as adding a new Cron Trigger, updating an old Cron Trigger, or deleting a Cron Trigger may take several minutes (up to 15 minutes) to propagate to the Cloudflare global network.
77+
78+
:::
79+
7480
After you have updated your Worker code to include a `"scheduled"` event, you must update your Worker project configuration.
7581

7682
#### Via the [Wrangler configuration file](/workers/wrangler/configuration/)
@@ -165,26 +171,16 @@ Some common time intervals that may be useful for setting up your Cron Trigger:
165171
- `59 23 LW * *`
166172
- 23:59 (UTC) on the last weekday of the month
167173

168-
## Test Cron Triggers
169-
170-
The recommended way of testing Cron Triggers is using Wrangler.
171-
172-
:::note[Cron Trigger changes take time to propagate.]
173-
174-
Changes such as adding a new Cron Trigger, updating an old Cron Trigger, or deleting a Cron Trigger may take several minutes (up to 15 minutes) to propagate to the Cloudflare global network.
175-
176-
:::
174+
## Test Cron Triggers locally
177175

178-
Test Cron Triggers using `Wrangler` by passing in the `--test-scheduled` flag to [`wrangler dev`](/workers/wrangler/commands/#dev). This will expose a `/__scheduled` (or `/cdn-cgi/handler/scheduled` for Python Workers) route which can be used to test using a HTTP request. To simulate different cron patterns, a `cron` query parameter can be passed in.
176+
Test Cron Triggers using Wrangler with [`wrangler dev`](/workers/wrangler/commands/#dev). This will expose a `/cdn-cgi/handler/scheduled` route which can be used to test using a HTTP request. To simulate different cron patterns, a `cron` query parameter can be passed in.
179177

180178
```sh
181-
npx wrangler dev --test-scheduled
182-
183-
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"
184-
185-
curl "http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*" # Python Workers
179+
curl "http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*"
186180
```
187181

182+
Optionally, you can also pass a `time` query parameter to override `controller.scheduledTime` in your scheduled event listener.
183+
188184
## View past events
189185

190186
To view the execution history of Cron Triggers, view **Cron Events**:

0 commit comments

Comments
 (0)