@@ -11,7 +11,6 @@ This guide highlights the differences and should help you migrate your project.
11
11
12
12
Here are some features you might be using in Defer that are coming this month to v3:
13
13
14
- - [ Scheduled tasks (including CRON)] ( /v3/tasks-scheduled ) will be available in mid-April.
15
14
- Triggering a task with a delay (like ` assignOptions ` delay in Defer) will be available soon – there is [ an alternative] ( #delay ) you can use for now.
16
15
17
16
You can view the full feature matrix [ here] ( /v3/feature-matrix ) .
@@ -256,6 +255,36 @@ export async function runLongRunningTask() {
256
255
257
256
#### Example 2: A CRON task
258
257
259
- <Warning >
260
- "Scheduled" tasks will be available by mid-April. This will allow you to replace Defer CRON tasks.
261
- </Warning >
258
+ We call these [ scheduled tasks] ( /v3/tasks-scheduled ) in Trigger.dev.
259
+
260
+ In Defer you might have a function like this:
261
+
262
+ ``` ts
263
+ import { defer } from " @defer/client" ;
264
+
265
+ async function sendMondayNewletter() {
266
+ // business logic here
267
+ }
268
+
269
+ export default defer .cron (sendMondayNewletter , " 0 0 * * 1" );
270
+ ```
271
+
272
+ In Trigger.dev the task looks like this:
273
+
274
+ ``` ts
275
+ import { schedules } from " @trigger.dev/sdk/v3" ;
276
+
277
+ // this task will run when any of the attached schedules trigger
278
+ export const sendMondayNewletter = schedules .task ({
279
+ id: " send-monday-newsletter" ,
280
+ run : async (payload ) => {
281
+ // business logic here
282
+ },
283
+ });
284
+ ```
285
+
286
+ Then you need to attach a schedule to the task, either using the dashboard or in your code. You can attach unlimited schedules to a task.
287
+
288
+ <Card title = " Attaching schedules" icon = " clock" href = " /v3/tasks-scheduled" >
289
+ How to attach a schedule to a task
290
+ </Card >
0 commit comments