added gracefulReload support for pm2
This commit is contained in:
parent
fb5a1de8a2
commit
1feeab33b9
6
app.js
6
app.js
@ -10,7 +10,7 @@ var gracefulShutdown = function() {
|
|||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
console.log("Closed out remaining connections.");
|
console.log("Closed out remaining connections.");
|
||||||
process.exit()
|
process.exit(0)
|
||||||
}, 2*1000);
|
}, 2*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,5 +20,9 @@ process.on('SIGTERM', gracefulShutdown);
|
|||||||
// listen for INT signal e.g. Ctrl-C
|
// listen for INT signal e.g. Ctrl-C
|
||||||
process.on('SIGINT', gracefulShutdown);
|
process.on('SIGINT', gracefulShutdown);
|
||||||
|
|
||||||
|
process.on('message', function(msg) {
|
||||||
|
if (msg == 'shutdown')
|
||||||
|
gracefulShutdown();
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = node;
|
module.exports = node;
|
||||||
|
Loading…
Reference in New Issue
Block a user