Skip to content

Commit aa3036f

Browse files
committed
Fix force-checkpointing-invoke timeout by disabling invoke retries
- Add retryPresets.noRetry to all 3 invoke operations in branch 2 - Prevents timeout when invokes fail and retry with default strategy - Keep 20s sleep in branch 1 since invoke retries were the real issue
1 parent 657abd9 commit aa3036f

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

packages/aws-durable-execution-sdk-js-examples/src/examples/force-checkpointing/invoke/force-checkpointing-invoke.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ createTests({
4747
expect(result.all[0].result).toBe("long-complete");
4848
expect(result.all[1].result).toBe("invokes-complete");
4949

50-
// Should complete in less than 25 seconds
51-
// (20s for long-running step + time for invokes)
52-
expect(duration).toBeLessThan(25000);
50+
// Should complete in less than 15 seconds
51+
// (10s for long-running step + time for invokes)
52+
expect(duration).toBeLessThan(15000);
5353

5454
// Should complete in a single invocation
5555
// The long-running step prevents termination, so the invoke operations

packages/aws-durable-execution-sdk-js-examples/src/examples/force-checkpointing/invoke/force-checkpointing-invoke.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,29 @@ export const handler = withDurableExecution(
2222
return await branchCtx.step(
2323
"long-running-step",
2424
async () => {
25-
await new Promise((resolve) => setTimeout(resolve, 15000));
25+
await new Promise((resolve) => setTimeout(resolve, 20000));
2626
return "long-complete";
2727
},
2828
{ retryStrategy: retryPresets.noRetry },
2929
);
3030
},
3131
// Branch 2: Multiple sequential invokes that need force checkpoint
3232
async (branchCtx: DurableContext) => {
33-
await branchCtx.invoke(event.functionNames[0], { input: "data-1" });
34-
await branchCtx.invoke(event.functionNames[1], { input: "data-2" });
35-
await branchCtx.invoke(event.functionNames[2], { input: "data-3" });
33+
await branchCtx.invoke(
34+
event.functionNames[0],
35+
{ input: "data-1" },
36+
{ retryStrategy: retryPresets.noRetry },
37+
);
38+
await branchCtx.invoke(
39+
event.functionNames[1],
40+
{ input: "data-2" },
41+
{ retryStrategy: retryPresets.noRetry },
42+
);
43+
await branchCtx.invoke(
44+
event.functionNames[2],
45+
{ input: "data-3" },
46+
{ retryStrategy: retryPresets.noRetry },
47+
);
3648
return "invokes-complete";
3749
},
3850
]);

0 commit comments

Comments
 (0)