forked from TrueCloudLab/frostfs-node
[#275] innerring: Add storage group search timeout
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
6836975272
commit
310a4c3e4d
4 changed files with 11 additions and 3 deletions
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue