[#184] Add config param for pool error threshold
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
af732d294c
commit
0f7737088d
5 changed files with 27 additions and 15 deletions
1
app.go
1
app.go
|
@ -114,6 +114,7 @@ func newApp(ctx context.Context, opt ...Option) App {
|
|||
prm.SetNodeDialTimeout(a.cfg.GetDuration(cfgConTimeout))
|
||||
prm.SetHealthcheckTimeout(a.cfg.GetDuration(cfgReqTimeout))
|
||||
prm.SetClientRebalanceInterval(a.cfg.GetDuration(cfgRebalance))
|
||||
prm.SetErrorThreshold(a.cfg.GetUint32(cfgPoolErrorThreshold))
|
||||
|
||||
for i := 0; ; i++ {
|
||||
address := a.cfg.GetString(cfgPeers + "." + strconv.Itoa(i) + ".address")
|
||||
|
|
|
@ -83,6 +83,8 @@ HTTP_GW_CONNECT_TIMEOUT=5s
|
|||
HTTP_GW_REQUEST_TIMEOUT=5s
|
||||
# Interval to check nodes health.
|
||||
HTTP_GW_REBALANCE_TIMER=30s
|
||||
# The number of errors on connection after which node is considered as unhealthy
|
||||
S3_GW_POOL_ERROR_THRESHOLD=100
|
||||
|
||||
# Enable zip compression to download files by common prefix.
|
||||
HTTP_GW_ZIP_COMPRESSION=false
|
||||
|
|
|
@ -84,6 +84,7 @@ upload_header:
|
|||
connect_timeout: 5s # Timeout to dial node.
|
||||
request_timeout: 5s # Timeout to check node health during rebalance.
|
||||
rebalance_timer: 30s # Interval to check nodes health.
|
||||
pool_error_threshold: 100 # The number of errors on connection after which node is considered as unhealthy.
|
||||
|
||||
zip:
|
||||
compression: false # Enable zip compression to download files by common prefix.
|
||||
|
|
|
@ -38,10 +38,11 @@ resolve_order:
|
|||
connect_timeout: 5s
|
||||
request_timeout: 5s
|
||||
rebalance_timer: 30s
|
||||
pool_error_threshold: 100
|
||||
```
|
||||
|
||||
| Parameter | Type | Default value | Description |
|
||||
|-------------------|------------|----------------|------------------------------------------------------------------------------------|
|
||||
|------------------------|------------|----------------|------------------------------------------------------------------------------------|
|
||||
| `listen_address` | `string` | `0.0.0.0:8082` | The address that the gateway is listening on. |
|
||||
| `tls_certificate` | `string` | | Path to the TLS certificate. |
|
||||
| `tls_key` | `string` | | Path to the TLS key. |
|
||||
|
@ -50,6 +51,7 @@ rebalance_timer: 30s
|
|||
| `connect_timeout` | `duration` | `10s` | Timeout to connect to a node. |
|
||||
| `request_timeout` | `duration` | `15s` | Timeout to check node health during rebalance. |
|
||||
| `rebalance_timer` | `duration` | `60s` | Interval to check node health. |
|
||||
| `pool_error_threshold` | `uint32` | `100` | The number of errors on connection after which node is considered as unhealthy. |
|
||||
|
||||
# `wallet` section
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ const (
|
|||
|
||||
defaultShutdownTimeout = 15 * time.Second
|
||||
|
||||
defaultPoolErrorThreshold uint32 = 100
|
||||
|
||||
cfgListenAddress = "listen_address"
|
||||
cfgTLSCertificate = "tls_certificate"
|
||||
cfgTLSKey = "tls_key"
|
||||
|
@ -40,10 +42,11 @@ const (
|
|||
cfgPprofEnabled = "pprof.enabled"
|
||||
cfgPprofAddress = "pprof.address"
|
||||
|
||||
// Timeouts.
|
||||
// Pool config.
|
||||
cfgConTimeout = "connect_timeout"
|
||||
cfgReqTimeout = "request_timeout"
|
||||
cfgRebalance = "rebalance_timer"
|
||||
cfgPoolErrorThreshold = "pool_error_threshold"
|
||||
|
||||
// Logger.
|
||||
cfgLoggerLevel = "logger.level"
|
||||
|
@ -122,6 +125,9 @@ func settings() *viper.Viper {
|
|||
// logger:
|
||||
v.SetDefault(cfgLoggerLevel, "debug")
|
||||
|
||||
// pool:
|
||||
v.SetDefault(cfgPoolErrorThreshold, defaultPoolErrorThreshold)
|
||||
|
||||
// web-server:
|
||||
v.SetDefault(cfgWebReadBufferSize, 4096)
|
||||
v.SetDefault(cfgWebWriteBufferSize, 4096)
|
||||
|
|
Loading…
Reference in a new issue