Skip to content

Commit

Permalink
Rename check timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdnk committed Oct 24, 2024
1 parent 68e09a7 commit 4e1e3cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Config struct {
// Address of the http server
Address string
// Time to wait for a health check response.
HealthCheckTimeout int `mapstructure:"health_check_timeout"`
CheckTimeout int `mapstructure:"check_timeout"`
// Status code returned in case of fail, 503 by default
UnavailableStatusCode int `mapstructure:"unavailable_status_code"`
}
Expand All @@ -17,7 +17,7 @@ func (c *Config) InitDefaults() {
if c.UnavailableStatusCode == 0 {
c.UnavailableStatusCode = http.StatusServiceUnavailable
}
if c.HealthCheckTimeout <= 0 {
c.HealthCheckTimeout = 60
if c.CheckTimeout <= 0 {
c.CheckTimeout = 60
}
}
4 changes: 2 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func (c *Plugin) Serve() chan error {
Addr: c.cfg.Address,
Handler: mux,
DisableGeneralOptionsHandler: false,
ReadTimeout: time.Duration(c.cfg.HealthCheckTimeout) * time.Second,
ReadHeaderTimeout: time.Duration(c.cfg.HealthCheckTimeout) * time.Second,
ReadTimeout: time.Duration(c.cfg.CheckTimeout) * time.Second,
ReadHeaderTimeout: time.Duration(c.cfg.CheckTimeout) * time.Second,
WriteTimeout: time.Minute,
IdleTimeout: time.Minute,
}
Expand Down
6 changes: 3 additions & 3 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"properties": {
"address": {
"description": "Host and port to listen on (eg.: `127.0.0.1:2114`). To query a plugin, pass its name as a query parameter called `plugin`, e.g. to check the `http` plugin, GET http://127.0.0.1:2114/health?plugin=http. You can query multiple plugins by appending multiple instances of the `plugin` parameter, e.g. GET http://127.0.0.1:2114/health?plugin=http&plugin=rpc.",
"description": "Host and port to listen on (eg.: `127.0.0.1:2114`). To query a plugin, pass its name as a query parameter called `plugin`, e.g. to check the `http` plugin, request `GET http://127.0.0.1:2114/health?plugin=http`. You can query multiple plugins by appending multiple instances of the `plugin` parameter, e.g. `GET http://127.0.0.1:2114/health?plugin=http&plugin=rpc`.",
"type": "string",
"minLength": 1,
"examples": [
Expand All @@ -24,8 +24,8 @@
"maximum": 599,
"default": 503
},
"health_check_timeout": {
"description": "The time to wait for a complete response from the internal health endpoint. Defaults to 60.",
"check_timeout": {
"description": "The maximum duration to wait for a complete response from the queried plugin(s), in seconds. Defaults to 60.",
"type": "integer",
"minimum": 1,
"default": 60
Expand Down

0 comments on commit 4e1e3cd

Please sign in to comment.