Server: Defer wg.Done call to ensure it's called (#20700)

(cherry picked from commit 3c7cfbebe8)
This commit is contained in:
Arve Knudsen
2019-11-28 08:43:49 +01:00
committed by Hugo Häggmark
parent 83dbc4c7c7
commit ccebda73d4
+2 -1
View File
@@ -135,11 +135,12 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
// handle http shutdown on server context done
go func() {
defer wg.Done()
<-ctx.Done()
if err := hs.httpSrv.Shutdown(context.Background()); err != nil {
hs.log.Error("Failed to shutdown server", "error", err)
}
wg.Done()
}()
switch setting.Protocol {