From 299f7beb6372cf35e89a1de338e3f3b0ac2e9155 Mon Sep 17 00:00:00 2001 From: ordinarthur <@arthurbarre.js@gmail.com> Date: Wed, 6 May 2026 15:37:03 +0200 Subject: [PATCH] =?UTF-8?q?fix(api):=20swap=20':'=20=E2=86=92=20'-'=20dans?= =?UTF-8?q?=20les=20BullMQ=20jobIds=20(interdit=20en=205.x)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BullMQ 5+ refuse les ':' dans les Custom Ids (validateOptions throws "Custom Id cannot contain :"). On utilisait `relance:` et `checkin:` pour assurer l'idempotence โ€” passe en `relance-` / `checkin-`. --- apps/api/app/services/checkin_scheduler.ts | 6 +++--- apps/api/app/services/relance_scheduler.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/api/app/services/checkin_scheduler.ts b/apps/api/app/services/checkin_scheduler.ts index d29694f..46f9248 100644 --- a/apps/api/app/services/checkin_scheduler.ts +++ b/apps/api/app/services/checkin_scheduler.ts @@ -33,7 +33,7 @@ export async function scheduleCheckinForInvoice( .where('status', 'scheduled') const queue = getQueue(CHECKIN_QUEUE) for (const t of existing) { - await queue.remove(`checkin:${t.id}`).catch(() => {}) + await queue.remove(`checkin-${t.id}`).catch(() => {}) t.useTransaction(trx ?? (null as never)) t.status = 'expired' await t.save() @@ -65,7 +65,7 @@ export async function scheduleCheckinForInvoice( { taskId: task.id, plain }, { delay, - jobId: `checkin:${task.id}`, + jobId: `checkin-${task.id}`, attempts: 3, backoff: { type: 'exponential', delay: 30_000 }, } @@ -88,7 +88,7 @@ export async function cancelCheckinForInvoice( const queue = getQueue(CHECKIN_QUEUE) for (const t of tasks) { - await queue.remove(`checkin:${t.id}`).catch(() => {}) + await queue.remove(`checkin-${t.id}`).catch(() => {}) t.useTransaction(trx ?? (null as never)) t.status = 'expired' await t.save() diff --git a/apps/api/app/services/relance_scheduler.ts b/apps/api/app/services/relance_scheduler.ts index 4579719..9b528b1 100644 --- a/apps/api/app/services/relance_scheduler.ts +++ b/apps/api/app/services/relance_scheduler.ts @@ -79,7 +79,8 @@ export async function scheduleRelancesForInvoice( { delay, // Idempotency : un seul job actif par task. - jobId: `relance:${task.id}`, + // BullMQ 5+ interdit `:` dans les custom jobIds โ†’ tiret. + jobId: `relance-${task.id}`, // Retry exponentiel โ€” si Mailpit est down, BullMQ retry 5x avec // backoff (cf. backend.md ยง13.2). attempts: 5,