DEV Community

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

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

acanimal profile image
Antonio Santiago Author

Awesome 🙌 !