Define ShutdownTimeout and SentryFlushTimeout constants
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user