From a72ea9ad1d9a301015f84816d8c7debd49b65e9f Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Sun, 12 Apr 2026 16:37:52 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20BullMQ=20job=20dedup=20=E2=80=94=20remove?= =?UTF-8?q?=20completed/failed=20jobs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completed jobs with the same jobId block new jobs from being added. Add removeOnComplete and removeOnFail to all job options so the same task can be re-triggered after completion. Co-Authored-By: Claude Opus 4.6 --- src/queue.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/queue.ts b/src/queue.ts index 73c2a7f..4e14837 100644 --- a/src/queue.ts +++ b/src/queue.ts @@ -161,6 +161,8 @@ export class TaskQueue { jobId: `create-${key}`, attempts: 3, backoff: { type: "exponential", delay: 5000 }, + removeOnComplete: true, + removeOnFail: true, }, ); } catch (err: unknown) { @@ -201,6 +203,8 @@ export class TaskQueue { jobId: `cleanup-${workspaceName}`, attempts: 5, backoff: { type: "exponential", delay: 10000 }, + removeOnComplete: true, + removeOnFail: true, }, ); @@ -311,6 +315,8 @@ export class TaskQueue { jobId: `cleanup-stale-${ws.name}-${Date.now()}`, attempts: 5, backoff: { type: "exponential", delay: 10000 }, + removeOnComplete: true, + removeOnFail: true, }, ); } catch (err) {