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) } }