fix(api): swap ':' → '-' dans les BullMQ jobIds (interdit en 5.x)
BullMQ 5+ refuse les ':' dans les Custom Ids (validateOptions throws "Custom Id cannot contain :"). On utilisait `relance:<taskId>` et `checkin:<taskId>` pour assurer l'idempotence — passe en `relance-<taskId>` / `checkin-<taskId>`.
This commit is contained in:
parent
0e8d0f3853
commit
299f7beb63
@ -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()
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user