Node.js · Senior · Question 18 of 75
Why might server.close() not finish during graceful shutdown?
- 1
server.close()only works for HTTPS servers - ✓Correct answer: It waits for open keep-alive connections; use
closeIdleConnections()and a hard timeout, orcloseAllConnections()as a last step - 3It needs the
--gracefulflag
Explanation
Typical shutdown: mark not ready, stop accepting connections, let in-flight requests finish, close idle connections, then close pools and exit, with a deadline.