daaku/go.grace — pull request #2 by stefantalpalaru (2013-05-09 12:41:26+00:00)
Title: ReadTimeout support

I have noticed a delay of about 2 minutes when gracefully stopping/restarting the server after browsing the site in Firefox. The culprit is the default keep-alive timeout of 115 seconds. Since we don't have the possibility to drop idle connections in the http server, the next best thing is setting a ReadTimeout on it.

This patch does that with a new gracehttp.SetReadTimeout function:

gracehttp.SetReadTimeout(10 * time.Second)
gracehttp.Serve(...)