Skip to content

Commit 1f7e484

Browse files
feat(openworkflow): change default child workflow timeout from 7 days to 1 year
1 parent bc18f2f commit 1f7e484

5 files changed

Lines changed: 9 additions & 7 deletions

File tree

ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ await step.sleep("wait-one-hour", "1h");
231231
**`step.runWorkflow(spec, input?, options?)`**: Starts a child workflow and
232232
waits for it durably. `options.name` sets the durable step name (defaults to the
233233
target workflow name in `spec`) and `options.timeout` controls the wait timeout
234-
(default 7d). When the timeout is reached, the parent step fails but the child
234+
(default 1y). When the timeout is reached, the parent step fails but the child
235235
workflow continues running independently.
236236

237237
All step APIs (`step.run`, `step.sleep`, and `step.runWorkflow`) share the same

packages/docs/docs/child-workflows.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const processOrder = defineWorkflow(
5656

5757
## Timeout
5858

59-
By default, the parent waits up to **7 days** for the child to finish. You can
59+
By default, the parent waits up to **1 year** for the child to finish. You can
6060
customize this with `options.timeout`:
6161

6262
```ts

packages/docs/docs/steps.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Starts a child workflow and waits for its result durably:
144144
const childOutput = await step.runWorkflow(
145145
generateReportWorkflow.spec,
146146
{ reportId: input.reportId },
147-
{ timeout: "5m" }, // optional, defaults to 7 days
147+
{ timeout: "5m" }, // optional, defaults to 1 year
148148
);
149149
```
150150

packages/openworkflow/worker/execution.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,10 @@ describe("StepExecutor", () => {
15171517

15181518
const millisecondsUntilWake =
15191519
parkedParent.availableAt.getTime() - Date.now();
1520-
expect(millisecondsUntilWake).toBeGreaterThan(6 * 24 * 60 * 60 * 1000);
1521-
expect(millisecondsUntilWake).toBeLessThan(8 * 24 * 60 * 60 * 1000);
1520+
const oneDayMs = 24 * 60 * 60 * 1000;
1521+
// Default runWorkflow timeout is 1 year.
1522+
expect(millisecondsUntilWake).toBeGreaterThan(300 * oneDayMs);
1523+
expect(millisecondsUntilWake).toBeLessThan(370 * oneDayMs);
15221524

15231525
const parentTerminalStatus = await tickUntilTerminal(
15241526
backend,

packages/openworkflow/worker/execution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,13 @@ function resolveWorkflowTimeoutAt(
268268
}
269269

270270
/**
271-
* Default workflow timeout: 7 days from a base time.
271+
* Default workflow timeout: 1 year from a base time.
272272
* @param base - Base timestamp (defaults to now)
273273
* @returns Timeout deadline
274274
*/
275275
function defaultWorkflowTimeoutAt(base: Readonly<Date> = new Date()): Date {
276276
const timeoutAt = new Date(base);
277-
timeoutAt.setDate(timeoutAt.getDate() + 7);
277+
timeoutAt.setFullYear(timeoutAt.getFullYear() + 1);
278278
return timeoutAt;
279279
}
280280

0 commit comments

Comments
 (0)