Define ShutdownTimeout and SentryFlushTimeout constants

This commit is contained in:
2026-01-08 02:22:58 -08:00
parent 0eb6193431
commit 751e557884

View File

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