[#193] cmd/neofs-node: Add dial timeouts to node configuration

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-23 15:59:30 +03:00 committed by Alex Vanin
parent 9148980bd0
commit 621840d542
2 changed files with 31 additions and 3 deletions

View file

@ -89,8 +89,10 @@ const (
cfgPolicerWorkScope = "policer.work_scope"
cfgPolicerExpRate = "policer.expansion_rate"
cfgPolicerHeadTimeout = "policer.head_timeout"
cfgPolicerDialTimeout = "policer.dial_timeout"
cfgReplicatorPutTimeout = "replicator.put_timeout"
cfgReplicatorPutTimeout = "replicator.put_timeout"
cfgReplicatorDialTimeout = "replicator.dial_timeout"
cfgReBootstrapEnabled = "bootstrap.periodic.enabled"
cfgReBootstrapInterval = "bootstrap.periodic.interval"
@ -101,6 +103,12 @@ const (
cfgObjectSearchPoolSize = "pool.object.search.size"
cfgObjectRangePoolSize = "pool.object.range.size"
cfgObjectRangeHashPoolSize = "pool.object.rangehash.size"
cfgObjectPutDialTimeout = "object.put.dial_timeout"
cfgObjectHeadDialTimeout = "object.head.dial_timeout"
cfgObjectRangeDialTimeout = "object.range.dial_timeout"
cfgObjectRangeHashDialTimeout = "object.rangehash.dial_timeout"
cfgObjectSearchDialTimeout = "object.search.dial_timeout"
)
const (

View file

@ -6,6 +6,7 @@ import (
"sync"
"github.com/mr-tron/base58"
"github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/v2/object"
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
@ -200,7 +201,9 @@ func initObjectService(c *cfg) {
),
replicator.WithLocalStorage(ls),
replicator.WithRemoteSender(
putsvc.NewRemoteSender(keyStorage, clientCache),
putsvc.NewRemoteSender(keyStorage, clientCache,
client.WithDialTimeout(c.viper.GetDuration(cfgReplicatorDialTimeout)),
),
),
)
@ -223,7 +226,9 @@ func initObjectService(c *cfg) {
),
policer.WithTrigger(ch),
policer.WithRemoteHeader(
headsvc.NewRemoteHeader(keyStorage, clientCache),
headsvc.NewRemoteHeader(keyStorage, clientCache,
client.WithDialTimeout(c.viper.GetDuration(cfgPolicerDialTimeout)),
),
),
policer.WithLocalAddressSource(c),
policer.WithHeadTimeout(
@ -258,6 +263,9 @@ func initObjectService(c *cfg) {
putsvc.WithNetworkState(c.cfgNetmap.state),
putsvc.WithWorkerPool(c.cfgObject.pool.put),
putsvc.WithLogger(c.log),
putsvc.WithClientOptions(
client.WithDialTimeout(c.viper.GetDuration(cfgObjectPutDialTimeout)),
),
)
sPutV2 := putsvcV2.NewService(
@ -273,6 +281,9 @@ func initObjectService(c *cfg) {
searchsvc.WithLocalAddressSource(c),
searchsvc.WithWorkerPool(c.cfgObject.pool.search),
searchsvc.WithLogger(c.log),
searchsvc.WithClientOptions(
client.WithDialTimeout(c.viper.GetDuration(cfgObjectSearchDialTimeout)),
),
)
sSearchV2 := searchsvcV2.NewService(
@ -289,6 +300,9 @@ func initObjectService(c *cfg) {
headsvc.WithRightChildSearcher(searchsvc.NewRightChildSearcher(sSearch)),
headsvc.WithWorkerPool(c.cfgObject.pool.head),
headsvc.WithLogger(c.log),
headsvc.WithClientOptions(
client.WithDialTimeout(c.viper.GetDuration(cfgObjectHeadDialTimeout)),
),
)
sHeadV2 := headsvcV2.NewService(
@ -305,6 +319,9 @@ func initObjectService(c *cfg) {
rangesvc.WithWorkerPool(c.cfgObject.pool.rng),
rangesvc.WithHeadService(sHead),
rangesvc.WithLogger(c.log),
rangesvc.WithClientOptions(
client.WithDialTimeout(c.viper.GetDuration(cfgObjectRangeDialTimeout)),
),
)
sRangeV2 := rangesvcV2.NewService(
@ -330,6 +347,9 @@ func initObjectService(c *cfg) {
rangehashsvc.WithRangeService(sRange),
rangehashsvc.WithWorkerPool(c.cfgObject.pool.rngHash),
rangehashsvc.WithLogger(c.log),
rangehashsvc.WithClientOptions(
client.WithDialTimeout(c.viper.GetDuration(cfgObjectRangeHashDialTimeout)),
),
)
sRangeHashV2 := rangehashsvcV2.NewService(