Fix an issue where runs were stuck executing when a child task failed and the parent task retried
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@trigger.dev/sdk": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix an issue where runs were stuck executing when a child task failed and the parent task retried
|
||||||
@@ -1333,6 +1333,8 @@ export class IO {
|
|||||||
await this._apiClient.failTask(this._id, task.id, {
|
await this._apiClient.failTask(this._id, task.id, {
|
||||||
error: error.cause.output as any,
|
error: error.cause.output as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsedError = ErrorWithStackSchema.safeParse(error);
|
const parsedError = ErrorWithStackSchema.safeParse(error);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createExpressServer } from "@trigger.dev/express";
|
import { createExpressServer } from "@trigger.dev/express";
|
||||||
import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
|
import { TriggerClient, eventTrigger, invokeTrigger } from "@trigger.dev/sdk";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const client = new TriggerClient({
|
export const client = new TriggerClient({
|
||||||
@@ -53,4 +53,52 @@ client.defineJob({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.defineJob({
|
||||||
|
id: "test-background-fetch-rety-stuck-error",
|
||||||
|
name: "Reproduce stuck error",
|
||||||
|
version: "0.0.1",
|
||||||
|
trigger: invokeTrigger({
|
||||||
|
schema: z.object({
|
||||||
|
url: z.string(),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
run: async (payload, io, ctx) => {
|
||||||
|
await io.runTask(
|
||||||
|
"test-background-fetch-retry",
|
||||||
|
async (task) => {
|
||||||
|
const response = await io.backgroundFetchResponse<any>(
|
||||||
|
payload.url,
|
||||||
|
payload.url,
|
||||||
|
{ method: "GET" },
|
||||||
|
{
|
||||||
|
timeout: {
|
||||||
|
durationInMs: 1000,
|
||||||
|
retry: {
|
||||||
|
limit: 2,
|
||||||
|
factor: 2,
|
||||||
|
minTimeoutInMs: 3000, // 3 secs
|
||||||
|
maxTimeoutInMs: 10000, // 10 secs
|
||||||
|
randomize: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Got response`, response);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
retry: {
|
||||||
|
limit: 4,
|
||||||
|
factor: 1.8,
|
||||||
|
minTimeoutInMs: 1500,
|
||||||
|
maxTimeoutInMs: 30000,
|
||||||
|
randomize: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
await io.logger.info("Got here");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
createExpressServer(client);
|
createExpressServer(client);
|
||||||
|
|||||||
Reference in New Issue
Block a user