Skip to content

Commit

Permalink
fix: call Queue.isReady() before job promote is called
Browse files Browse the repository at this point in the history
  • Loading branch information
Fotis Tsokos authored and Fotis Tsokos committed Jan 19, 2020
1 parent 081b37f commit 4b3abca
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,13 @@ Job.prototype.moveToDelayed = function(timestamp, ignoreLock) {
Job.prototype.promote = function() {
const queue = this.queue;
const jobId = this.id;

return scripts.promote(queue, jobId).then(result => {
if (result === -1) {
throw new Error('Job ' + jobId + ' is not in a delayed state');
}
});
return queue.isReady().then(() =>
scripts.promote(queue, jobId).then(result => {
if (result === -1) {
throw new Error('Job ' + jobId + ' is not in a delayed state');
}
})
);
};

/**
Expand Down

0 comments on commit 4b3abca

Please sign in to comment.