forked from TrueCloudLab/frostfs-sdk-go
pool: Use timeout for context cancelling
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
ca57c8f442
commit
308bdcc2f5
1 changed files with 5 additions and 1 deletions
|
@ -198,7 +198,11 @@ func (p *Pool) Dial(ctx context.Context) error {
|
||||||
clients := make([]client, len(nodes))
|
clients := make([]client, len(nodes))
|
||||||
for j, node := range nodes {
|
for j, node := range nodes {
|
||||||
clients[j] = newTreeClient(node.Address(), p.dialOptions...)
|
clients[j] = newTreeClient(node.Address(), p.dialOptions...)
|
||||||
if err := clients[j].dial(ctx); err != nil {
|
|
||||||
|
tctx, cancel := context.WithTimeout(ctx, p.rebalanceParams.nodeRequestTimeout)
|
||||||
|
err := clients[j].dial(tctx)
|
||||||
|
cancel()
|
||||||
|
if err != nil {
|
||||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", node.Address()), zap.Error(err))
|
p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", node.Address()), zap.Error(err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue