Skip to content
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 doesn't shutdown at all #775

Closed
ghost opened this issue Dec 15, 2015 · 5 comments
Closed

Graceful shutdown doesn't shutdown at all #775

ghost opened this issue Dec 15, 2015 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Dec 15, 2015

Hello,

I have followed the documentation but I don't see to be able to exit the process with a graceful shutdown.
The code in the shutdown block never gets executed. Last line does but the process does not exit.

// if both buttons are pressed, disconnect:
if (left && right) {
process.once('SIGTERM', function(sig) {
kue.shutdown(5000, function(err) {
console.log('Kue shutdown: ', err || '');
process.exit(0);
});
});
tag.disconnect();
}

Any help is wildely appreciated.
thx

@behrad
Copy link
Collaborator

behrad commented Dec 15, 2015

Is your shutdown callback getting called? (do you see 'Kue Shutdown' at console?)

@ghost
Copy link
Author

ghost commented Dec 16, 2015

The entire code in the process.once block doesn't get called (sorry I implicitly implied that some gets called in my previous statement) - it doesn't shuts down at all.

@behrad
Copy link
Collaborator

behrad commented Dec 16, 2015

‍‍‍process.once('SIGTERM', function(sig) will be called when you send a SIGTERM signal to your node.js process which can be done by pressing CTRL+C in the terminal which you process is running.
This is nothing to do with Kue.

@ghost
Copy link
Author

ghost commented Dec 16, 2015

Thank you for the explanation, now I understand how it is suppoesed to be used.
What would be the recommened way to shutdown at will (exist the process naturally and not by sig.)?

@behrad
Copy link
Collaborator

behrad commented Dec 16, 2015

kue.shutdown(2000, function(err) {
  console.log('Kue shutdown: ', err || '');
  //process.exit(0); you should not need this line
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant