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 30ba73c commit b24aeeaCopy full SHA for b24aeea
examples/job-catalog/src/stressTest.ts
@@ -86,4 +86,23 @@ client.defineJob({
86
},
87
});
88
89
+client.defineJob({
90
+ id: "long.running",
91
+ name: "Long Running Job",
92
+ version: "1.0.0",
93
+ trigger: eventTrigger({
94
+ name: "long.running",
95
+ }),
96
+ run: async (payload, io, ctx) => {
97
+ // Perform X tasks in an iteration, each one taking X milliseconds
98
+ for (let i = 0; i < payload.iterations; i++) {
99
+ await io.runTask(`task.${i}`, { name: `Task ${i}` }, async (task) => {
100
+ await new Promise((resolve) => setTimeout(resolve, payload.duration ?? 5000));
101
+
102
+ return { i };
103
+ });
104
+ }
105
+ },
106
+});
107
108
createExpressServer(client);
0 commit comments