Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
loshz committed Feb 20, 2024
1 parent af32d84 commit 6e7ef56
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/debug/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ func EnableDebugServer(ctx context.Context, addr string, port int) {
// Expose default runtime metrics.
router.Handle("/debug/metrics", promhttp.Handler())

// Configure HTTP server with sane defaults.
timeout := 10 * time.Second
srv := &http.Server{
Handler: router,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
Handler: router,
ReadTimeout: timeout,
ReadHeaderTimeout: timeout,
WriteTimeout: timeout,
IdleTimeout: timeout,
}

go func() {
Expand All @@ -48,9 +52,7 @@ func EnableDebugServer(ctx context.Context, addr string, port int) {
}
}()

// Wait for dataplane to exit, and shutdown the server.
// Wait for dataplane to exit, and shutdown the server immediately.
<-ctx.Done()
if err := srv.Shutdown(context.Background()); err != nil {
log.Error("error shutting down debug server", "error", err)
}
_ = srv.Close()
}

0 comments on commit 6e7ef56

Please sign in to comment.