From f3aee4039cdc7750d6fcda94d2d28859c638fab2 Mon Sep 17 00:00:00 2001 From: Terin Stock Date: Mon, 19 Oct 2026 02:56:04 +0200 Subject: fix(server): timeout panic If no timeout was provided the HTTPServer would panic on shutdown, instead of defaulting for 5 seconds as documented. --- server/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/server.go') diff --git a/server/server.go b/server/server.go index cd63820..9ea6833 100644 --- a/server/server.go +++ b/server/server.go @@ -20,7 +20,7 @@ type HTTPServer struct { // ShutdownTimeout is the amount of time to gracefully shutdown, defaults // to 5 seconds. Should be less than the supervisor's Timeout. - ShutdownTimeout *time.Duration + ShutdownTimeout time.Duration } // Serve starts the [http.Server] returned by NewServer. The function blocks until the HTTP server @@ -41,7 +41,7 @@ func (s *HTTPServer) Serve(ctx context.Context) error { case <-ctx.Done(): } - timeout := cmp.Or(*s.ShutdownTimeout, 5*time.Second) + timeout := cmp.Or(s.ShutdownTimeout, 5*time.Second) shutdownCtx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() -- cgit v1.3