Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix(workers): retry worker job completion success/failure reporting

Mohamed Basseme578322e826f
diff --git a/packages/plugins/queue-restate/src/runner.ts b/packages/plugins/queue-restate/src/runner.ts
index 2bda9f72..ce28df47 100644
--- a/packages/plugins/queue-restate/src/runner.ts
+++ b/packages/plugins/queue-restate/src/runner.ts
@@ -109,24 +109,18 @@ export function buildRunnerService<T, R>(
ctx: restate.Context,
data: { job: RunnerJobData<T>; result: R },
): Promise<void> => {
- await ctx.run(
- "onComplete",
- async () => {
- await funcs.onComplete?.(
- {
- id: data.job.id,
- data: data.job.data,
- priority: data.job.priority,
- runNumber: data.job.runNumber,
- abortSignal: AbortSignal.timeout(data.job.timeoutSecs * 1000),
- },
- data.result,
- );
- },
- {
- maxRetryAttempts: 1,
- },
- );
+ await ctx.run("onComplete", async () => {
+ await funcs.onComplete?.(
+ {
+ id: data.job.id,
+ data: data.job.data,
+ priority: data.job.priority,
+ runNumber: data.job.runNumber,
+ abortSignal: AbortSignal.timeout(data.job.timeoutSecs * 1000),
+ },
+ data.result,
+ );
+ });
},
onError: async (
@@ -142,22 +136,16 @@ export function buildRunnerService<T, R>(
},
);
- await ctx.run(
- "onError",
- async () => {
- await funcs.onError?.({
- id: data.job.id,
- data: data.job.data,
- priority: data.job.priority,
- runNumber: data.job.runNumber,
- numRetriesLeft: data.job.numRetriesLeft,
- error: reconstructedError,
- });
- },
- {
- maxRetryAttempts: 1,
- },
- );
+ await ctx.run("onError", async () => {
+ await funcs.onError?.({
+ id: data.job.id,
+ data: data.job.data,
+ priority: data.job.priority,
+ runNumber: data.job.runNumber,
+ numRetriesLeft: data.job.numRetriesLeft,
+ error: reconstructedError,
+ });
+ });
},
},
});