Skip to content

Commit

Permalink
Make sure job is object before accessing properties on it
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Michalski committed Aug 17, 2020
1 parent 17a6a24 commit 9bfc969
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clean_failed_job_stacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ forEach(args, async (name, index) => {

const jobs = await queue.getFailed()
const retriedJobCount = await reduce(jobs, async (count, job) => {
if (job.attemptsMade <= job.opts.attempts) {
if (!job || typeof job !== 'object' || job.attemptsMade <= job.opts.attempts) {
return count
}
const { id, data, opts } = job
Expand Down
2 changes: 1 addition & 1 deletion retry_failed_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ forEach(args, async (name, index) => {

const jobs = await queue.getFailed()
const retriedJobCount = await reduce(jobs, async (count, job) => {
if (job.attemptsMade > MAX_FAILED_COUNT) {
if (!job || typeof job !== 'object' || job.attemptsMade > MAX_FAILED_COUNT) {
return count
}
try {
Expand Down

0 comments on commit 9bfc969

Please sign in to comment.