Skip to content

Commit 7900fe5

Browse files
committed
feat(core): add maxComputeSeconds, deprecate maxDuration in user-facing types
1 parent 62e0066 commit 7900fe5

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

packages/core/src/v3/config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,28 @@ export type TriggerConfig = {
165165
*/
166166
logLevel?: LogLevel;
167167

168+
/**
169+
* The maximum duration in compute-time **seconds** that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
170+
*
171+
* Minimum value is 5 seconds.
172+
*
173+
* Setting this value will affect all tasks in the project. You can override it on a per-task basis.
174+
*
175+
* @see https://trigger.dev/docs/tasks/overview#maxcomputeseconds-option
176+
*/
177+
maxComputeSeconds?: number;
178+
168179
/**
169180
* The maximum duration in compute-time seconds that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
170181
*
171182
* Minimum value is 5 seconds
172183
*
173184
* Setting this value will effect all tasks in the project.
174185
*
186+
* @deprecated Use `maxComputeSeconds` instead — same semantics, clearer unit. If both are set, `maxComputeSeconds` wins.
175187
* @see https://trigger.dev/docs/tasks/overview#maxduration-option
176188
*/
177-
maxDuration: number;
189+
maxDuration?: number;
178190

179191
/**
180192
* Set a default time-to-live (TTL) for all task runs in the project. If a run is not executed within this time, it will be removed from the queue and never execute.

packages/core/src/v3/types/tasks.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,19 @@ type CommonTaskOptions<
271271
}
272272
| MachinePresetName;
273273

274+
/**
275+
* The maximum duration in compute-time **seconds** that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
276+
*
277+
* Minimum value is 5 seconds.
278+
*/
279+
maxComputeSeconds?: number;
280+
274281
/**
275282
* The maximum duration in compute-time seconds that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
276283
*
277284
* Minimum value is 5 seconds
285+
*
286+
* @deprecated Use `maxComputeSeconds` instead — same semantics, clearer unit. If both are set, `maxComputeSeconds` wins.
278287
*/
279288
maxDuration?: number;
280289

@@ -876,12 +885,23 @@ export type TriggerOptions = {
876885
*/
877886
metadata?: Record<string, SerializableJson>;
878887

888+
/**
889+
* The maximum duration in compute-time **seconds** that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
890+
*
891+
* This will override the task's `maxComputeSeconds` (or the legacy `maxDuration`).
892+
*
893+
* Minimum value is 5 seconds.
894+
*/
895+
maxComputeSeconds?: number;
896+
879897
/**
880898
* The maximum duration in compute-time seconds that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
881899
*
882900
* This will override the task's maxDuration.
883901
*
884902
* Minimum value is 5 seconds
903+
*
904+
* @deprecated Use `maxComputeSeconds` instead — same semantics, clearer unit. If both are set, `maxComputeSeconds` wins.
885905
*/
886906
maxDuration?: number;
887907

0 commit comments

Comments
 (0)