Hacker News new | ask | show | jobs
by frakturfreund 4387 days ago
The release notes mention the graceful shutdown of a http.Server:

"The net/http package now provides an optional Server.ConnState callback to hook various phases of a server connection's lifecycle (see ConnState). This can be used to implement rate limiting or graceful shutdown."

Knows anyone here a code example for this?

4 comments

I'm super pumped about this -- I plan to spend the weekend upgrading a graceful shutdown server I maintain to use it.

https://github.com/braintree/manners

Please note that net/http does not implement graceful shutdown, 1.3 has made it easy to implement in your application code.