aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2026-10-19 02:56:04 +0200
committerLibravatar Terin Stock <terinjokes@gmail.com>2026-10-19 03:01:46 +0200
commitf3aee4039cdc7750d6fcda94d2d28859c638fab2 (patch)
tree5bf53c0a5ab80eacb1cf08c741578701b769eb11
parentfeat: use suture supervisor (diff)
downloadcgit-httpd-trunk.tar.xz
fix(server): timeout panicHEADv0.6.1trunk
If no timeout was provided the HTTPServer would panic on shutdown, instead of defaulting for 5 seconds as documented.
-rw-r--r--server/server.go4
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()