From 751e55788406d08079ac41e70f7b9667ab03c9ea Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 8 Jan 2026 02:22:58 -0800 Subject: [PATCH] Define ShutdownTimeout and SentryFlushTimeout constants --- internal/server/server.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/server/server.go b/internal/server/server.go index 6ea108c..a930d32 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -21,6 +21,12 @@ import ( "sneak.berlin/go/pixa/internal/middleware" ) +// Shutdown configuration constants. +const ( + ShutdownTimeout = 5 * time.Second + SentryFlushTimeout = 2 * time.Second +) + // ServerParams defines dependencies for Server. type ServerParams struct { fx.In @@ -125,7 +131,7 @@ func (s *Server) serve() int { func (s *Server) cleanShutdown() { s.exitCode = 0 - ctxShutdown, shutdownCancel := context.WithTimeout(context.Background(), 5*time.Second) + ctxShutdown, shutdownCancel := context.WithTimeout(context.Background(), ShutdownTimeout) defer shutdownCancel() if s.httpServer != nil { @@ -135,7 +141,7 @@ func (s *Server) cleanShutdown() { } if s.sentryEnabled { - sentry.Flush(2 * time.Second) + sentry.Flush(SentryFlushTimeout) } }