Skip to content

Commit 71808fa

Browse files
committed
Improved maxDuration comments in the templates
1 parent 82ebfc7 commit 71808fa

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

packages/cli-v3/templates/examples/schedule.mjs.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { logger, schedules, wait } from "@trigger.dev/sdk/v3";
22

33
export const firstScheduledTask = schedules.task({
44
id: "first-scheduled-task",
5-
//every hour
5+
// Every hour
66
cron: "0 * * * *",
7-
maxDuration: 300, // 5 minutes
7+
// Set an optional maxDuration to prevent tasks from running indefinitely
8+
maxDuration: 300, // Stop executing after 300 secs (5 mins) of compute
89
run: async (payload, { ctx }) => {
910
// The payload contains the last run timestamp that you can use to check if this is the first run
1011
// And calculate the time since the last run

packages/cli-v3/templates/examples/schedule.ts.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { logger, schedules, wait } from "@trigger.dev/sdk/v3";
22

33
export const firstScheduledTask = schedules.task({
44
id: "first-scheduled-task",
5-
//every hour
5+
// Every hour
66
cron: "0 * * * *",
7-
maxDuration: 300, // 5 minutes
7+
// Set an optional maxDuration to prevent tasks from running indefinitely
8+
maxDuration: 300, // Stop executing after 300 secs (5 mins) of compute
89
run: async (payload, { ctx }) => {
910
// The payload contains the last run timestamp that you can use to check if this is the first run
1011
// And calculate the time since the last run

packages/cli-v3/templates/examples/simple.mjs.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { logger, task, wait } from "@trigger.dev/sdk/v3";
22

33
export const helloWorldTask = task({
44
id: "hello-world",
5-
maxDuration: 300, // 5 minutes
5+
// Set an optional maxDuration to prevent tasks from running indefinitely
6+
maxDuration: 300, // Stop executing after 300 secs (5 mins) of compute
67
run: async (payload, { ctx }) => {
78
logger.log("Hello, world!", { payload, ctx });
89

packages/cli-v3/templates/examples/simple.ts.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { logger, task, wait } from "@trigger.dev/sdk/v3";
22

33
export const helloWorldTask = task({
44
id: "hello-world",
5-
maxDuration: 300, // 5 minutes
5+
// Set an optional maxDuration to prevent tasks from running indefinitely
6+
maxDuration: 300, // Stop executing after 300 secs (5 mins) of compute
67
run: async (payload: any, { ctx }) => {
78
logger.log("Hello, world!", { payload, ctx });
89

0 commit comments

Comments
 (0)