Skip to content

Commit

Permalink
Check MAX_FAILED_COUNT in jobExceedingAttemptsFilter to enable cleani…
Browse files Browse the repository at this point in the history
…ng stacks for jobs with fewer attempts than job.opts.attempts.
  • Loading branch information
Robert Michalski committed Aug 22, 2020
1 parent b220aa3 commit fde479a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion retry_failed_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ getFailedQueues(queueNames)
const retriedJobCountsForEachQueue = await Promise.all(
queues.map(async queue => {
const failedJobs = getAttemptedJobs(await queue.getFailed())
.filter(job => job.attemptsMade > MAX_FAILED_COUNT)

if (!failedJobs.length) {
return queue.close().then(() => 0)
Expand Down
2 changes: 1 addition & 1 deletion utils/jobsExceedingAttemptsFilter.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = jobs => jobs.filter(job => job && typeof job === 'object' && job.attemptsMade > job.opts.attempts)
module.exports = jobs => jobs.filter(job => job && typeof job === 'object' && job.attemptsMade > (parseInt(process.env.MAX_FAILED_COUNT) || job.opts.attempts))

0 comments on commit fde479a

Please sign in to comment.