-
Notifications
You must be signed in to change notification settings - Fork 868
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
Graceful shutdown #61
Conversation
I think this is useful, but wouldn't it be more useful to use a signal? instead of a js-api? |
* @return {String} escaped text | ||
*/ | ||
|
||
function escape(html) { |
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.
I wouldn't really worry about xss, Kue should never be running on a public-facing port or anything like that
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.
Anyway, this is not about security. If a task title has html, it should be escaped and never rendered in Kue GUI as html. Shouldn't it?
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.
I suppose, though I'm not sure when the title would have html
In my app, I use both of. And both are useful. process.once('SIGQUIT', function(){
console.log('shutting down the queue..');
jobs.shutdown(function(err){
if (err) console.error(err);
console.log('queue shutdown complete');
process.exit();
})
}) |
for sure, definitely stems from the js-api, I guess we could leave it as the method for now since cluster would need a slightly different solution as well |
Are there plans to merge this at all? It's a very useful feature 👍 |
👍 |
1 similar comment
👍 |
PR #121 has the changes here so we could possible close this issue too @drudge Also, anyone interested in this PR or #121 until it gets merged, see https://github.com/LOKE/kue as we merged to our master. |
feature is introduced in #256 |
Hi,
I've made graceful shutdown functionality.
The implementation is simple: Queue object collects all of it's workers, and then, when
.shutdown()
method is called, it propagates to all of them, and wait until all workers will done their current jobs (if there's some jobs in progress).Also, added
worker.running
property to workers, to avoid new jobs pulling when shutting down. And ``worker.job` which points to current job in progress, to determine whether the worker is free or not.To shutdown Kue object gracefully, simply use the following api:
Closes #57