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

This commit is contained in:
Arve Knudsen 2019-11-27 13:42:15 +01:00 committed by GitHub
parent 1751770394
commit 3c7cfbebe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {