[#1449] policer: Fix selection of new storage candidates

`Policer` should pass list of selected candidates into `WithNodes`
method of `replicator.Task`. In previous implementation `processNodes`
method passed an opposite list: failed nodes and/or the local one.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/fyrchik/cli-common
Leonard Lyubich 2022-05-30 08:19:59 +03:00 committed by LeL
parent 855cbf5a3a
commit e96ea4635c
1 changed files with 7 additions and 9 deletions

View File

@ -97,17 +97,17 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad
ctx.needLocalCopy = true
shortage--
} else {
callCtx, cancel := context.WithTimeout(ctx, p.headTimeout)
continue
}
_, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo))
callCtx, cancel := context.WithTimeout(ctx, p.headTimeout)
cancel()
_, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo))
if client.IsErrObjectNotFound(err) {
continue
}
cancel()
if !client.IsErrObjectNotFound(err) {
if err != nil {
log.Error("receive object header to check policy compliance",
zap.String("error", err.Error()),
@ -115,8 +115,6 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad
} else {
shortage--
}
continue
}
nodes = append(nodes[:i], nodes[i+1:]...)