diff options
| author | 2026-10-19 02:56:04 +0200 | |
|---|---|---|
| committer | 2026-10-19 03:01:46 +0200 | |
| commit | f3aee4039cdc7750d6fcda94d2d28859c638fab2 (patch) | |
| tree | 5bf53c0a5ab80eacb1cf08c741578701b769eb11 | |
| parent | feat: use suture supervisor (diff) | |
| download | cgit-httpd-f3aee4039cdc7750d6fcda94d2d28859c638fab2.tar.xz | |
If no timeout was provided the HTTPServer would panic on shutdown,
instead of defaulting for 5 seconds as documented.
| -rw-r--r-- | server/server.go | 4 |
1 files changed, 2 insertions, 2 deletions
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() |
