forked from TrueCloudLab/frostfs-node
[#1374] tree: Use NewClient to create grpc connection for sync
Created connection will be used to sync trees, so it is ok to defer dial to the first RPC call. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
944160427b
commit
54fe8383a4
1 changed files with 3 additions and 3 deletions
|
@ -294,7 +294,7 @@ func (s *Service) synchronizeTree(ctx context.Context, cid cid.ID, from uint64,
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
cc, err := s.dialCtx(egCtx, a)
|
cc, err := s.createConnection(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Warn(logs.TreeFailedToConnectForTreeSynchronization, zap.Error(err), zap.String("address", addr))
|
s.log.Warn(logs.TreeFailedToConnectForTreeSynchronization, zap.Error(err), zap.String("address", addr))
|
||||||
return false
|
return false
|
||||||
|
@ -332,8 +332,8 @@ func (s *Service) synchronizeTree(ctx context.Context, cid cid.ID, from uint64,
|
||||||
return from
|
return from
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Service) dialCtx(egCtx context.Context, a network.Address) (*grpc.ClientConn, error) {
|
func (*Service) createConnection(a network.Address) (*grpc.ClientConn, error) {
|
||||||
return grpc.DialContext(egCtx, a.URIAddr(),
|
return grpc.NewClient(a.URIAddr(),
|
||||||
grpc.WithChainUnaryInterceptor(
|
grpc.WithChainUnaryInterceptor(
|
||||||
metrics.NewUnaryClientInterceptor(),
|
metrics.NewUnaryClientInterceptor(),
|
||||||
tracing_grpc.NewUnaryClientInteceptor(),
|
tracing_grpc.NewUnaryClientInteceptor(),
|
||||||
|
|
Loading…
Reference in a new issue