DEV Community

Discussion on: Graceful shutdown NodeJS HTTP server when using PM2 (4/4)

Collapse
 
gajus profile image
Gajus Kuizinas

Calling server.close() is not enough – the server will hang until there are open connections. This could mean couple of seconds or hours. You need to track connections and terminate them one by one. Refer to my article about connection handling in Node.js dev.to/gajus/how-to-terminate-a-ht....

Collapse
 
acanimal profile image
Antonio Santiago

Awesome 🙌 !