Skip to content

Commit

Permalink
Improved jobs exceeding max failed attempts filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Michalski committed Nov 23, 2020
1 parent 016c459 commit 719e705
Show file tree
Hide file tree
Showing 2 changed files with 3 additions 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 @@ -10,7 +10,6 @@ const getAttemptedJobs = require('./utils/jobsExceedingAttemptsFilter')
console.log(`${new Date().toISOString()} - Checking for failed jobs in ${queueNames.join(', ')} queues`)

const CONCURRENCY = parseInt(process.env.CONCURRENCY) || 50
const MAX_FAILED_COUNT = Number.parseInt(process.env.MAX_FAILED_COUNT) || 100

const startTime = Date.now()

Expand Down
4 changes: 3 additions & 1 deletion utils/jobsExceedingAttemptsFilter.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = jobs => jobs.filter(job => job && typeof job === 'object' && job.attemptsMade > (parseInt(process.env.MAX_FAILED_COUNT) || job.opts.attempts))
const MAX_FAILED_COUNT = Number.parseInt(process.env.MAX_FAILED_COUNT)

module.exports = jobs => jobs.filter(job => job && typeof job === 'object' && job.attemptsMade > (MAX_FAILED_COUNT || Number.parseInt(job.opts.attempts) || 100))

0 comments on commit 719e705

Please sign in to comment.