[#234] Update SDK to support timeout for stream
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
a6ec194c2a
commit
408d914347
8 changed files with 13 additions and 3 deletions
|
@ -10,6 +10,7 @@ This document outlines major changes between releases.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Support the `Date` header on upload (#214)
|
- Support the `Date` header on upload (#214)
|
||||||
|
- Timeout for individual operations in streaming RPC (#234)
|
||||||
|
|
||||||
## [0.25.0] - 2022-10-31
|
## [0.25.0] - 2022-10-31
|
||||||
|
|
||||||
|
|
1
app.go
1
app.go
|
@ -137,6 +137,7 @@ func newApp(ctx context.Context, opt ...Option) App {
|
||||||
var prm pool.InitParameters
|
var prm pool.InitParameters
|
||||||
prm.SetKey(key)
|
prm.SetKey(key)
|
||||||
prm.SetNodeDialTimeout(a.cfg.GetDuration(cfgConTimeout))
|
prm.SetNodeDialTimeout(a.cfg.GetDuration(cfgConTimeout))
|
||||||
|
prm.SetNodeStreamTimeout(a.cfg.GetDuration(cfgStreamTimeout))
|
||||||
prm.SetHealthcheckTimeout(a.cfg.GetDuration(cfgReqTimeout))
|
prm.SetHealthcheckTimeout(a.cfg.GetDuration(cfgReqTimeout))
|
||||||
prm.SetClientRebalanceInterval(a.cfg.GetDuration(cfgRebalance))
|
prm.SetClientRebalanceInterval(a.cfg.GetDuration(cfgRebalance))
|
||||||
prm.SetErrorThreshold(a.cfg.GetUint32(cfgPoolErrorThreshold))
|
prm.SetErrorThreshold(a.cfg.GetUint32(cfgPoolErrorThreshold))
|
||||||
|
|
|
@ -79,6 +79,8 @@ HTTP_GW_UPLOAD_HEADER_USE_DEFAULT_TIMESTAMP=false
|
||||||
|
|
||||||
# Timeout to dial node.
|
# Timeout to dial node.
|
||||||
HTTP_GW_CONNECT_TIMEOUT=5s
|
HTTP_GW_CONNECT_TIMEOUT=5s
|
||||||
|
# Timeout for individual operations in streaming RPC.
|
||||||
|
HTTP_GW_STREAM_TIMEOUT=10s
|
||||||
# Timeout to check node health during rebalance.
|
# Timeout to check node health during rebalance.
|
||||||
HTTP_GW_REQUEST_TIMEOUT=5s
|
HTTP_GW_REQUEST_TIMEOUT=5s
|
||||||
# Interval to check nodes health.
|
# Interval to check nodes health.
|
||||||
|
|
|
@ -82,6 +82,7 @@ upload_header:
|
||||||
use_default_timestamp: false # Create timestamp for object if it isn't provided by header.
|
use_default_timestamp: false # Create timestamp for object if it isn't provided by header.
|
||||||
|
|
||||||
connect_timeout: 5s # Timeout to dial node.
|
connect_timeout: 5s # Timeout to dial node.
|
||||||
|
stream_timeout: 10s # Timeout for individual operations in streaming RPC.
|
||||||
request_timeout: 5s # Timeout to check node health during rebalance.
|
request_timeout: 5s # Timeout to check node health during rebalance.
|
||||||
rebalance_timer: 30s # Interval to check nodes health.
|
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.
|
pool_error_threshold: 100 # The number of errors on connection after which node is considered as unhealthy.
|
||||||
|
|
|
@ -66,6 +66,7 @@ resolve_order:
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
connect_timeout: 5s
|
connect_timeout: 5s
|
||||||
|
stream_timeout: 10s
|
||||||
request_timeout: 5s
|
request_timeout: 5s
|
||||||
rebalance_timer: 30s
|
rebalance_timer: 30s
|
||||||
pool_error_threshold: 100
|
pool_error_threshold: 100
|
||||||
|
@ -79,6 +80,7 @@ pool_error_threshold: 100
|
||||||
| `rpc_endpoint` | `string` | yes | | The address of the RPC host to which the gateway connects to resolve bucket names. |
|
| `rpc_endpoint` | `string` | yes | | The address of the RPC host to which the gateway connects to resolve bucket names. |
|
||||||
| `resolve_order` | `[]string` | yes | `[nns, dns]` | Order of bucket name resolvers to use. |
|
| `resolve_order` | `[]string` | yes | `[nns, dns]` | Order of bucket name resolvers to use. |
|
||||||
| `connect_timeout` | `duration` | | `10s` | Timeout to connect to a node. |
|
| `connect_timeout` | `duration` | | `10s` | Timeout to connect to a node. |
|
||||||
|
| `stream_timeout` | `duration` | | `10s` | Timeout for individual operations in streaming RPC. |
|
||||||
| `request_timeout` | `duration` | | `15s` | Timeout to check node health during rebalance. |
|
| `request_timeout` | `duration` | | `15s` | Timeout to check node health during rebalance. |
|
||||||
| `rebalance_timer` | `duration` | | `60s` | Interval to check node health. |
|
| `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. |
|
| `pool_error_threshold` | `uint32` | | `100` | The number of errors on connection after which node is considered as unhealthy. |
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
github.com/fasthttp/router v1.4.1
|
github.com/fasthttp/router v1.4.1
|
||||||
github.com/nspcc-dev/neo-go v0.99.4
|
github.com/nspcc-dev/neo-go v0.99.4
|
||||||
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0
|
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0
|
||||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221114144617-d047289182a1
|
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221115140820-b4b07a3c4e11
|
||||||
github.com/prometheus/client_golang v1.13.0
|
github.com/prometheus/client_golang v1.13.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/spf13/viper v1.8.1
|
github.com/spf13/viper v1.8.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -766,8 +766,8 @@ github.com/nspcc-dev/neofs-crypto v0.4.0 h1:5LlrUAM5O0k1+sH/sktBtrgfWtq1pgpDs09f
|
||||||
github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs=
|
github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs=
|
||||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4=
|
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4=
|
||||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659/go.mod h1:/jay1lr3w7NQd/VDBkEhkJmDmyPNsu4W+QV2obsUV40=
|
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659/go.mod h1:/jay1lr3w7NQd/VDBkEhkJmDmyPNsu4W+QV2obsUV40=
|
||||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221114144617-d047289182a1 h1:SAB+pu0aXXxOsBxBNZG9F5c1YLCpSAW5HhBI5Id43d8=
|
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221115140820-b4b07a3c4e11 h1:dcofGaVR6najaIdh0JOXoxqV1MLJWnJ3pPMhD5gowV4=
|
||||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221114144617-d047289182a1/go.mod h1:7bH8zabbewpXstaXKoV0Tk3lV7KFYadi5edLU5yDERY=
|
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.7.0.20221115140820-b4b07a3c4e11/go.mod h1:7bH8zabbewpXstaXKoV0Tk3lV7KFYadi5edLU5yDERY=
|
||||||
github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||||
github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
|
github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
|
||||||
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||||
|
|
|
@ -21,6 +21,7 @@ const (
|
||||||
defaultRebalanceTimer = 60 * time.Second
|
defaultRebalanceTimer = 60 * time.Second
|
||||||
defaultRequestTimeout = 15 * time.Second
|
defaultRequestTimeout = 15 * time.Second
|
||||||
defaultConnectTimeout = 10 * time.Second
|
defaultConnectTimeout = 10 * time.Second
|
||||||
|
defaultStreamTimeout = 10 * time.Second
|
||||||
|
|
||||||
defaultShutdownTimeout = 15 * time.Second
|
defaultShutdownTimeout = 15 * time.Second
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ const (
|
||||||
|
|
||||||
// Pool config.
|
// Pool config.
|
||||||
cfgConTimeout = "connect_timeout"
|
cfgConTimeout = "connect_timeout"
|
||||||
|
cfgStreamTimeout = "stream_timeout"
|
||||||
cfgReqTimeout = "request_timeout"
|
cfgReqTimeout = "request_timeout"
|
||||||
cfgRebalance = "rebalance_timer"
|
cfgRebalance = "rebalance_timer"
|
||||||
cfgPoolErrorThreshold = "pool_error_threshold"
|
cfgPoolErrorThreshold = "pool_error_threshold"
|
||||||
|
@ -112,6 +114,7 @@ func settings() *viper.Viper {
|
||||||
flags.String(cmdAddress, "", `address of wallet account`)
|
flags.String(cmdAddress, "", `address of wallet account`)
|
||||||
flags.String(cmdConfig, "", "config path")
|
flags.String(cmdConfig, "", "config path")
|
||||||
flags.Duration(cfgConTimeout, defaultConnectTimeout, "gRPC connect timeout")
|
flags.Duration(cfgConTimeout, defaultConnectTimeout, "gRPC connect timeout")
|
||||||
|
flags.Duration(cfgStreamTimeout, defaultStreamTimeout, "gRPC individual message timeout")
|
||||||
flags.Duration(cfgReqTimeout, defaultRequestTimeout, "gRPC request timeout")
|
flags.Duration(cfgReqTimeout, defaultRequestTimeout, "gRPC request timeout")
|
||||||
flags.Duration(cfgRebalance, defaultRebalanceTimer, "gRPC connection rebalance timer")
|
flags.Duration(cfgRebalance, defaultRebalanceTimer, "gRPC connection rebalance timer")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue