We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a414e65 commit 3fb68b7Copy full SHA for 3fb68b7
references/hello-world/src/trigger/example.ts
@@ -4,6 +4,12 @@ import { ResourceMonitor } from "../resourceMonitor.js";
4
5
export const helloWorldTask = task({
6
id: "hello-world",
7
+ retry: {
8
+ maxAttempts: 3,
9
+ minTimeoutInMs: 500,
10
+ maxTimeoutInMs: 1000,
11
+ factor: 1.5,
12
+ },
13
run: async (payload: any, { ctx }) => {
14
logger.info("Hello, world from the init", { ctx, payload });
15
logger.info("env vars", {
@@ -22,6 +28,10 @@ export const helloWorldTask = task({
22
28
23
29
await setTimeout(payload.sleepFor ?? 180_000);
24
30
31
+ if (payload.throwError) {
32
+ throw new Error("Forced error to cause a retry");
33
+ }
34
+
25
35
logger.trace(
26
36
"my trace",
27
37
async (span) => {
0 commit comments