diff --git a/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts b/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts index 607b7d987b..715cf4ba8b 100644 --- a/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts +++ b/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts @@ -116,7 +116,7 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy { } async add = object>(job: Job): Promise> { - const retries = this.options.setRetries?.(job.queueName, job) ?? job.retries; + const retries = this.options.setRetries?.(job.queueName, job) ?? job.retries ?? 0; const backoff = this.options.setBackoff?.(job.queueName, job) ?? { delay: 1000, type: 'exponential', @@ -297,7 +297,7 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy { error: jobJson.failedReason, progress: +jobJson.progress, result: jobJson.returnvalue, - retries: bullJob.opts.attempts ?? 0, + retries: bullJob.opts.attempts ? bullJob.opts.attempts - 1 : 0, }); }