Skip to content

Commit

Permalink
fix(job-queue-plugin): Correct retry setting for BullMQ jobs
Browse files Browse the repository at this point in the history
Relates to #1467
  • Loading branch information
michaelbromley committed Sep 26, 2023
1 parent baeb036 commit 972ba0e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy {
}

async add<Data extends JobData<Data> = object>(job: Job<Data>): Promise<Job<Data>> {
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',
Expand Down Expand Up @@ -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,
});
}

Expand Down

0 comments on commit 972ba0e

Please sign in to comment.