diff --git a/pkg/config/oracle_config.go b/pkg/config/oracle_config.go index 479abd0ba..a12454f70 100644 --- a/pkg/config/oracle_config.go +++ b/pkg/config/oracle_config.go @@ -18,6 +18,6 @@ type OracleConfiguration struct { // NeoFSConfiguration is a config for the NeoFS service. type NeoFSConfiguration struct { - Nodes []string `yaml:"Nodes"` - Timeout int `yaml:"Timeout"` + Nodes []string `yaml:"Nodes"` + Timeout time.Duration `yaml:"Timeout"` } diff --git a/pkg/services/oracle/oracle.go b/pkg/services/oracle/oracle.go index 8cfb3b424..94f5084f1 100644 --- a/pkg/services/oracle/oracle.go +++ b/pkg/services/oracle/oracle.go @@ -108,6 +108,9 @@ func NewOracle(cfg Config) (*Oracle, error) { if o.MainCfg.RequestTimeout == 0 { o.MainCfg.RequestTimeout = defaultRequestTimeout } + if o.MainCfg.NeoFS.Timeout == 0 { + o.MainCfg.NeoFS.Timeout = defaultRequestTimeout + } if o.MainCfg.MaxConcurrentRequests == 0 { o.MainCfg.MaxConcurrentRequests = defaultMaxConcurrentRequests } diff --git a/pkg/services/oracle/request.go b/pkg/services/oracle/request.go index 9a354b330..e61f47ba6 100644 --- a/pkg/services/oracle/request.go +++ b/pkg/services/oracle/request.go @@ -140,7 +140,7 @@ func (o *Oracle) processRequest(priv *keys.PrivateKey, req request) error { resp.Code = transaction.Error } case neofs.URIScheme: - ctx, cancel := context.WithTimeout(context.Background(), time.Duration(o.MainCfg.NeoFS.Timeout)*time.Millisecond) + ctx, cancel := context.WithTimeout(context.Background(), o.MainCfg.NeoFS.Timeout) defer cancel() index := (int(req.ID) + incTx.attempts) % len(o.MainCfg.NeoFS.Nodes) res, err := neofs.Get(ctx, priv, u, o.MainCfg.NeoFS.Nodes[index])