diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 780080d2c..715dce1ee 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -96,4 +96,5 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("audit.timeout.get", "5s") cfg.SetDefault("audit.timeout.head", "5s") cfg.SetDefault("audit.timeout.rangehash", "5s") + cfg.SetDefault("audit.timeout.search", "10s") } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index a6ff34953..51ea3cb87 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -242,6 +242,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error MorphClient: server.morphClient, IRList: server, ClientCache: clientCache, + RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), TaskManager: auditTaskManager, Reporter: server, }) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index 5bd65998e..0e5bc0bbc 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -2,7 +2,6 @@ package audit import ( "context" - "time" "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/container" @@ -134,8 +133,7 @@ func (ap *Processor) findStorageGroups(cid *container.ID, shuffled netmap.Nodes) sgSearchParams.WithContainerID(cid) sgSearchParams.WithSearchFilters(sgFilter) - // fixme: timeout from config - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), ap.searchTimeout) result, err := cli.SearchObject(ctx, sgSearchParams) cancel() diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index d764cea46..8652486b8 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -2,6 +2,7 @@ package audit import ( "context" + "time" "github.com/nspcc-dev/neo-go/pkg/util" SDKClient "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -45,6 +46,7 @@ type ( morphClient *client.Client irList Indexer clientCache NeoFSClientCache + searchTimeout time.Duration containerClient *wrapContainer.Wrapper netmapClient *wrapNetmap.Wrapper @@ -63,6 +65,7 @@ type ( MorphClient *client.Client IRList Indexer ClientCache NeoFSClientCache + RPCSearchTimeout time.Duration TaskManager TaskManager Reporter audit.Reporter } @@ -90,6 +93,10 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/audit: global state is not set") case p.ClientCache == nil: return nil, errors.New("ir/audit: neofs RPC client cache is not set") + case p.TaskManager == nil: + return nil, errors.New("ir/audit: audit task manager is not set") + case p.Reporter == nil: + return nil, errors.New("ir/audit: audit result reporter is not set") } pool, err := ants.NewPool(ProcessorPoolSize, ants.WithNonblocking(true)) @@ -117,6 +124,7 @@ func New(p *Params) (*Processor, error) { morphClient: p.MorphClient, irList: p.IRList, clientCache: p.ClientCache, + searchTimeout: p.RPCSearchTimeout, containerClient: containerClient, netmapClient: netmapClient, taskManager: p.TaskManager,