Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ func init() {

serveCmd.PersistentFlags().Bool("disable-telemetry", false, "Disable anonymized telemetry reports - for more information please visit https://www.ory.sh/docs/ecosystem/sqa")
serveCmd.PersistentFlags().Bool("sqa-opt-out", false, "Disable anonymized telemetry reports - for more information please visit https://www.ory.sh/docs/ecosystem/sqa")
serveCmd.PersistentFlags().Int("default-shutdown-timeout", 5, "Set the default shutdown timeout in seconds for server shutdown when trapping SIGTERM and SIGINT")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my view this should go into the config file instead

}
7 changes: 7 additions & 0 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ func RunServe(version, build, date string) func(cmd *cobra.Command, args []strin
adminmw.Use(telemetry)
publicmw.Use(telemetry)

// Override the `graceful.DefaultShutdownTimeout` value
graceful.DefaultShutdownTimeout = 5 * time.Second
defaultShutdownTimeout, _ := cmd.Flags().GetInt("default-shutdown-timeout")
if defaultShutdownTimeout > 0 {
graceful.DefaultShutdownTimeout = time.Duration(defaultShutdownTimeout) * time.Second
}

prometheusRepo := metrics.NewConfigurablePrometheusRepository(d, logger)
var wg sync.WaitGroup
tasks := []func(){
Expand Down