[#9999] 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
3f3fcc3e74
commit
a6f82a899a
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
|
||||
}
|
||||
|
||||
cc, err := s.dialCtx(egCtx, a)
|
||||
cc, err := s.createConnection(a)
|
||||
if err != nil {
|
||||
s.log.Warn(logs.TreeFailedToConnectForTreeSynchronization, zap.Error(err), zap.String("address", addr))
|
||||
return false
|
||||
|
@ -332,8 +332,8 @@ func (s *Service) synchronizeTree(ctx context.Context, cid cid.ID, from uint64,
|
|||
return from
|
||||
}
|
||||
|
||||
func (*Service) dialCtx(egCtx context.Context, a network.Address) (*grpc.ClientConn, error) {
|
||||
return grpc.DialContext(egCtx, a.URIAddr(),
|
||||
func (*Service) createConnection(a network.Address) (*grpc.ClientConn, error) {
|
||||
return grpc.NewClient(a.URIAddr(),
|
||||
grpc.WithChainUnaryInterceptor(
|
||||
metrics.NewUnaryClientInterceptor(),
|
||||
tracing_grpc.NewUnaryClientInteceptor(),
|
||||
|
|
Loading…
Reference in a new issue