-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 scale down #1346
Comments
i do have the same issue, as i need to close some connection before the worker process gets killed. any suggestions? |
I know it's been a while since this was closed, but nobody gave any alternative for gracefulStop. After a bit of digging I found a solution and wanted to post it here, as my Google searches brought me here first.
Simple solution is to call your same clean shutdown code in a |
SIGINT is the way to go: SIGINT handle now works as expected (it will be called every time the process get exited). To try it:
|
Patch available on pm2@2.1.4 (main): $ npm install pm2 -g
$ pm2 update |
When scaling down the children are killed and not gracefully shutdown.
Eg. In my app code I have:
I launch it with pm2:
and I give the command:
one child is terminated, but the message event is not fired. So I guess that the child is brutally killed.
The message events are correctly fired when I do:
What am I missing?
Is it possible to "gracefullly" scale down?
The text was updated successfully, but these errors were encountered: