Skip to content

Commit c431248

Browse files
authored
Merge pull request #29 from Somefive/feat/add-min-request-timeout-arg
Feat: add min-request-timeout args
2 parents 42496db + bb87806 commit c431248

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pkg/util/apiserver/options/server_run_options.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,22 @@ import (
2727

2828
// ServerRunOptions is the extension option for configuring the APIServer
2929
type ServerRunOptions struct {
30-
RequestTimeout time.Duration
30+
RequestTimeout time.Duration
31+
MinRequestTimeout int
3132
}
3233

3334
func NewServerRunOptions() *ServerRunOptions {
3435
defaults := server.NewConfig(serializer.CodecFactory{})
3536
return &ServerRunOptions{
36-
RequestTimeout: defaults.RequestTimeout,
37+
RequestTimeout: defaults.RequestTimeout,
38+
MinRequestTimeout: defaults.MinRequestTimeout,
3739
}
3840
}
3941

4042
// ApplyTo set the params in server.RecommendConfig
4143
func (s *ServerRunOptions) ApplyTo(c *server.Config) error {
4244
c.RequestTimeout = s.RequestTimeout
45+
c.MinRequestTimeout = s.MinRequestTimeout
4346
return nil
4447
}
4548

@@ -49,6 +52,11 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
4952
"An optional field indicating the duration a handler must keep a request open before timing "+
5053
"it out. This is the default request timeout for requests but may be overridden by flags such as "+
5154
"--min-request-timeout for specific types of requests.")
55+
fs.IntVar(&s.MinRequestTimeout, "min-request-timeout", s.MinRequestTimeout, ""+
56+
"An optional field indicating the minimum number of seconds a handler must keep "+
57+
"a request open before timing it out. Currently only honored by the watch request "+
58+
"handler, which picks a randomized value above this number as the connection timeout, "+
59+
"to spread out load.")
5260
}
5361

5462
var defaultServerRunOptions = NewServerRunOptions()

0 commit comments

Comments
 (0)