Skip to content

Commit

Permalink
feat: update keel
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Mar 22, 2024
1 parent 3717872 commit d46ba48
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions cmd/flags.go
Expand Up @@ -87,24 +87,24 @@ func addHistoryLimitFlag(flags *pflag.FlagSet, v *viper.Viper) {
_ = v.BindEnv("history.limit", "CONTENT_SERVER_HISTORY_LIMIT")
}

func gracefulTimeoutFlag(v *viper.Viper) time.Duration {
return v.GetDuration("graceful_timeout")
func gracefulPeriodFlag(v *viper.Viper) time.Duration {
return v.GetDuration("graceful.period")
}

func addGracefulTimeoutFlag(flags *pflag.FlagSet, v *viper.Viper) {
flags.Duration("graceful-timeout", 0, "Timeout duration for graceful shutdown")
_ = v.BindPFlag("graceful_timeout", flags.Lookup("graceful-timeout"))
_ = v.BindEnv("graceful_timeout", "CONTENT_SERVER_GRACEFUL_TIMEOUT")
func addShutdownTimeoutFlag(flags *pflag.FlagSet, v *viper.Viper) {
flags.Duration("graceful-period", 0, "Graceful shutdown period")
_ = v.BindPFlag("graceful.period", flags.Lookup("graceful-period"))
_ = v.BindEnv("graceful.period", "CONTENT_SERVER_GRACEFULE_PERIOD")
}

func shutdownTimeoutFlag(v *viper.Viper) time.Duration {
return v.GetDuration("shutdown_timeout")
func gracefulTimeoutFlag(v *viper.Viper) time.Duration {
return v.GetDuration("graceful.timeout")
}

func addShutdownTimeoutFlag(flags *pflag.FlagSet, v *viper.Viper) {
flags.Duration("shutdown-timeout", 0, "Timeout duration for shutdown")
_ = v.BindPFlag("shutdown_timeout", flags.Lookup("shutdown-timeout"))
_ = v.BindEnv("shutdown_timeout", "CONTENT_SERVER_SHUTDOWN_TIMEOUT")
func addGracefulTimeoutFlag(flags *pflag.FlagSet, v *viper.Viper) {
flags.Duration("graceful-timeout", 0, "Graceful shutdown timeout to wait")
_ = v.BindPFlag("graceful.timeout", flags.Lookup("graceful-timeout"))
_ = v.BindEnv("graceful.timeout", "CONTENT_SERVER_GRACEFUL_TIMEOUT")
}

func serviceHealthzEnabledFlag(v *viper.Viper) bool {
Expand Down
2 changes: 1 addition & 1 deletion cmd/http.go
Expand Up @@ -38,7 +38,7 @@ func NewHTTPCommand() *cobra.Command {
keel.WithPrometheusMeter(servicePrometheusEnabledFlag(v)),
keel.WithOTLPGRPCTracer(otelEnabledFlag(v)),
keel.WithGracefulTimeout(gracefulTimeoutFlag(v)),
keel.WithShutdownTimeout(shutdownTimeoutFlag(v)),
keel.WithGracefulPeriod(gracefulPeriodFlag(v)),
)

l := svr.Logger()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -3,7 +3,7 @@ module github.com/foomo/contentserver
go 1.21

require (
github.com/foomo/keel v0.17.4-0.20240322093729-5c5d32717bb4 // #190 (5c5d327) update otel
github.com/foomo/keel v0.17.4-0.20240322201811-f791248997cb // #190 (f791248) update-otel
github.com/google/uuid v1.6.0
github.com/json-iterator/go v1.1.12
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -60,8 +60,8 @@ github.com/fbiville/markdown-table-formatter v0.3.0 h1:PIm1UNgJrFs8q1htGTw+wnnNY
github.com/fbiville/markdown-table-formatter v0.3.0/go.mod h1:q89TDtSEVDdTaufgSbfHpNVdPU/bmfvqNkrC5HagmLY=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/foomo/keel v0.17.4-0.20240322093729-5c5d32717bb4 h1:lmIP24NSehzMR9928PRg78jt1BYP9eEuhr3/WZouAZg=
github.com/foomo/keel v0.17.4-0.20240322093729-5c5d32717bb4/go.mod h1:+90rU3I9pErPp3n28ZaSB708n+nfPEf5cVP1lqn5Sf8=
github.com/foomo/keel v0.17.4-0.20240322201811-f791248997cb h1:5Ubh2/jeI9cm7uT1RBPrbMsy0uEvvtJOgkTvD+zplrA=
github.com/foomo/keel v0.17.4-0.20240322201811-f791248997cb/go.mod h1:+90rU3I9pErPp3n28ZaSB708n+nfPEf5cVP1lqn5Sf8=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
Expand Down

0 comments on commit d46ba48

Please sign in to comment.