Skip to content

Commit 3fb68b7

Browse files
committed
couple of tweaks for testing stuff
1 parent a414e65 commit 3fb68b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

references/hello-world/src/trigger/example.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { ResourceMonitor } from "../resourceMonitor.js";
44

55
export const helloWorldTask = task({
66
id: "hello-world",
7+
retry: {
8+
maxAttempts: 3,
9+
minTimeoutInMs: 500,
10+
maxTimeoutInMs: 1000,
11+
factor: 1.5,
12+
},
713
run: async (payload: any, { ctx }) => {
814
logger.info("Hello, world from the init", { ctx, payload });
915
logger.info("env vars", {
@@ -22,6 +28,10 @@ export const helloWorldTask = task({
2228

2329
await setTimeout(payload.sleepFor ?? 180_000);
2430

31+
if (payload.throwError) {
32+
throw new Error("Forced error to cause a retry");
33+
}
34+
2535
logger.trace(
2636
"my trace",
2737
async (span) => {

0 commit comments

Comments
 (0)