Skip to content

Commit 553c58e

Browse files
committed
Update the init command to set the maxDuration and include a commented out maxDuration in the config file
1 parent c4eadab commit 553c58e

File tree

7 files changed

+10
-1
lines changed

7 files changed

+10
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const firstScheduledTask = schedules.task({
44
id: "first-scheduled-task",
55
//every hour
66
cron: "0 * * * *",
7+
maxDuration: 300, // 5 minutes
78
run: async (payload, { ctx }) => {
89
// The payload contains the last run timestamp that you can use to check if this is the first run
910
// And calculate the time since the last run

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const firstScheduledTask = schedules.task({
44
id: "first-scheduled-task",
55
//every hour
66
cron: "0 * * * *",
7+
maxDuration: 300, // 5 minutes
78
run: async (payload, { ctx }) => {
89
// The payload contains the last run timestamp that you can use to check if this is the first run
910
// And calculate the time since the last run

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

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

33
export const helloWorldTask = task({
44
id: "hello-world",
5+
maxDuration: 300, // 5 minutes
56
run: async (payload, { ctx }) => {
67
logger.log("Hello, world!", { payload, ctx });
78

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

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

33
export const helloWorldTask = task({
44
id: "hello-world",
5+
maxDuration: 300, // 5 minutes
56
run: async (payload: any, { ctx }) => {
67
logger.log("Hello, world!", { payload, ctx });
78

packages/cli-v3/templates/trigger.config.mjs.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default defineConfig({
44
project: "${projectRef}",
55
runtime: "${runtime}",
66
logLevel: "log",
7+
// Set the maxDuration to 300 seconds for all tasks. See https://trigger.dev/docs/runs/max-duration
8+
// maxDuration: 300,
79
retries: {
810
enabledInDev: true,
911
default: {

packages/cli-v3/templates/trigger.config.ts.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default defineConfig({
44
project: "${projectRef}",
55
runtime: "${runtime}",
66
logLevel: "log",
7+
// Set the maxDuration to 300 seconds for all tasks. See https://trigger.dev/docs/runs/max-duration
8+
// maxDuration: 300,
79
retries: {
810
enabledInDev: true,
911
default: {

references/v3-catalog/trigger.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default defineConfig({
1717
machine: "medium-1x",
1818
instrumentations: [new OpenAIInstrumentation()],
1919
additionalFiles: ["wrangler/wrangler.toml"],
20-
maxDuration: 60,
20+
// Set the maxDuration to 300s for all tasks. See https://trigger.dev/docs/runs/max-duration
21+
// maxDuration: 300,
2122
retries: {
2223
enabledInDev: false,
2324
default: {

0 commit comments

Comments
 (0)