doc-pm2 icon indicating copy to clipboard operation
doc-pm2 copied to clipboard

Graceful shutdown

Open Valentinishe opened this issue 7 years ago • 2 comments
trafficstars

https://pm2.io/doc/en/runtime/best-practices/graceful-shutdown/

At this page is code for closing connections:

server.close(function (err) {
    if (err) {
      console.error(err);
      process.exit(1);
    }
});

This not works for keep-alive connections, which are using in Google Chrome and some console tools, like npm autocannon.

Valentinishe avatar Jul 24 '18 10:07 Valentinishe

what's your recommendation?

Unitech avatar Sep 19 '18 14:09 Unitech

Use npm module like https://www.npmjs.com/package/http-shutdown or write your own decission.

Valentinishe avatar Nov 02 '18 10:11 Valentinishe