New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: cleanup whenCurrentJobsFinished #1542
chore: cleanup whenCurrentJobsFinished #1542
Conversation
@@ -1174,49 +1174,20 @@ Queue.prototype.clean = function(grace, type, limit) { | |||
* @returns {Promise} | |||
*/ | |||
Queue.prototype.whenCurrentJobsFinished = function() { | |||
return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the unnecessary new Promise
.
this.bclient.once('end', function(){ | ||
console.error('ENDED!'); | ||
setTimeout(function(){ | ||
this.bclient.connect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all this commented code.
Cleanup and document whenCurrentJobsFinished. And since it's now official API, add some tests for it.
edde75c
to
d13d99d
Compare
1 similar comment
} | ||
*/ | ||
//this.bclient.connect(); | ||
return Promise.all([this.processing[0]]).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After upgrade to latest version of bull we are seeing that on shutdown, it doesn't properly wait for all jobs to complete.
It seems to me that this is likely the change that caused the problem. Was it intentional to change this to only wait for the first job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that seems like a dumb mistake on my part. Thanks for catching it @holm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix: #1586
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix!
Cleanup and document whenCurrentJobsFinished. And since it's now official API, add some tests for it.