health: fix shutdown of health check server

This commit is contained in:
2025-01-03 14:01:52 +01:00
parent 9e2d6fb74e
commit f6d160a7f8
2 changed files with 3 additions and 5 deletions

View File

@@ -59,11 +59,10 @@ func (srv *Server) Listen(ctx context.Context, port int) error {
<-ctx.Done()
ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
defer cancel()
g.Go(func() error {
if err := hsrv.Shutdown(ctx); err != nil {
shCtx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
if err := hsrv.Shutdown(shCtx); err != nil {
srv.log.Error("health check server shutdown failed", "err", err)
return err
}