From f6d160a7f8f4de42473115b2513caf874022f12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Fri, 3 Jan 2025 14:01:52 +0100 Subject: [PATCH] health: fix shutdown of health check server --- health/health_server.go | 7 +++---- tracing/tracing.go | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/health/health_server.go b/health/health_server.go index bdb9c54..9603542 100644 --- a/health/health_server.go +++ b/health/health_server.go @@ -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 } diff --git a/tracing/tracing.go b/tracing/tracing.go index 7961432..2ba4ac9 100644 --- a/tracing/tracing.go +++ b/tracing/tracing.go @@ -196,7 +196,6 @@ func SetupSDK(ctx context.Context, cfg *TracerConfig) (shutdown TpShutdownFunc, } func newOLTPExporter(ctx context.Context, cfg *TracerConfig) (sdktrace.SpanExporter, error) { - log := logger.Setup() var tlsConfig *tls.Config