npm install kill-it-with-fire
var killItWithFire = require('kill-it-with-fire');
process.on('SIGTERM', function () {
// Do the stuff that *should* let your process exit cleanly...
sockets.closeEm();
server.stopIt();
connections.breakUpWith();
// And usually that works fine...but when something is still hanging...
killItWithFire();
// Alternatively, you can pass options to `killItWithFire()`.
killItWithFire({wait: 5000})
});
The time (in ms) to wait before killing it with fire.
A function to use to log the immolation.
The code to exit the process with.