health: fix shutdown of health check server
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user