Enable graceful shutdown for https server#85
Conversation
For some reason, the httpsServer does not shut down when server.Stop is called.
|
Hey @erka, thanks for fixing this! (And sorry for the slow response on the PR, been busy with the holidays and so on :)) What you had looks good, but I also thought we could extract a helper for the I also left out the extra logging there -- mainly for simplicity, but also because the likely error we'd see there would be the context timeout any time we have to forcibly shutdown a long request, but that's not really an error; it's just part of how the shutdown operates. We could catch and swallow those errors specifically, but I'm not sure it's worth it. |
|
Great refactoring @kevinmcconnell Logs could provide valuable insights. If a forced shutdown occurs (context timeout), some users/services might not receive their data, and I personally prefer to be aware of such situations. But I also agree with you that it could be a noise in many situations. |
|
That's true, yes. I was mostly concerned with that timeout message suggesting that something is failing, when really the shutdown process is working as intended. But I agree it could be nice to know that connections had to be terminated. I've made a small change so now we'll show a clear warning if that happens ("Closing active connections"). Thanks again for your contribution on this, @erka! |
For some reason, the httpsServer does not shut down when server.Stop is called.