Fase 1a: fix jobId (BullMQ rechaza ':' en custom job id)

El dry-run contra prod destapo 'Error: Custom Id cannot contain :': el jobId era
canal:notificationId. Cambiado a canal_notificationId. Test que lo fija.
This commit is contained in:
vjrj 2026-07-13 08:40:38 +02:00
parent 6163deecf3
commit 4f8d866226
2 changed files with 24 additions and 2 deletions

View file

@ -38,9 +38,10 @@ export function createQueues(cfg: Config): Record<Channel, Queue<SendJob>> {
}
/**
* Job id = `${channel}:${notificationId}` so BullMQ itself dedupes enqueues:
* Job id = `${channel}_${notificationId}` so BullMQ itself dedupes enqueues:
* re-polling the same pending doc will not create a second job.
* (BullMQ rejects custom job ids containing ':', hence the underscore.)
*/
export function jobId(job: SendJob): string {
return `${job.channel}:${job.notificationId}`;
return `${job.channel}_${job.notificationId}`;
}