diff --git a/retry_failed_jobs.js b/retry_failed_jobs.js index 9d40453..fd02e10 100644 --- a/retry_failed_jobs.js +++ b/retry_failed_jobs.js @@ -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) diff --git a/utils/jobsExceedingAttemptsFilter.js b/utils/jobsExceedingAttemptsFilter.js index 531e863..f4f1046 100644 --- a/utils/jobsExceedingAttemptsFilter.js +++ b/utils/jobsExceedingAttemptsFilter.js @@ -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))