Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.62k stars 2.63k forks source link

FEATURE REQUEST - process.send('offline'); #1842

Closed michaelBenin closed 8 years ago

michaelBenin commented 8 years ago

Related: https://github.com/Unitech/pm2/issues/1303#issuecomment-164960671

Use case:

During a graceful shutdown call process.send('offline'); to let pm2 that the current process should be treated as a non running process. Similarly how the api exists for process.send('online');

michaelBenin commented 8 years ago

After doing a bit more research using reload and adding the process.on('message').

Solution here: http://pm2.keymetrics.io/docs/usage/cluster-mode/#graceful-reload

Unitech commented 8 years ago

With the 1.0 you will be also able to do this in any kind of process: http://pm2.keymetrics.io/docs/usage/signals-clean-restart/

michaelBenin commented 8 years ago

I've found that even with graceful reload pm2 still load balances work to workers that are shutting down.

michaelBenin commented 8 years ago

Ah ok, I am using the latest of what's published on NPM. Any timeframe when 1.0 will be available on npm? Is it stable to use installing from github? I see 1.0 has been cut for a couple days.

Unitech commented 8 years ago

I will publish it today :)

michaelBenin commented 8 years ago

Testing this later today to see if PM2 still sends incoming traffic to a shutting down process.