adds context timeout to transport.DialAddress (#1528)
This commit is contained in:
parent
724aaab78d
commit
b4b99fa979
@ -67,8 +67,8 @@ func (transport *Transport) DialNode(ctx context.Context, node *pb.Node, opts ..
|
||||
grpc.FailOnNonTempDialError(true),
|
||||
}, opts...)
|
||||
|
||||
timedCtx, cf := context.WithTimeout(ctx, connWaitTimeout)
|
||||
defer cf()
|
||||
timedCtx, cancel := context.WithTimeout(ctx, connWaitTimeout)
|
||||
defer cancel()
|
||||
|
||||
conn, err = grpc.DialContext(timedCtx, node.GetAddress().Address, options...)
|
||||
if err != nil {
|
||||
@ -98,7 +98,10 @@ func (transport *Transport) DialAddress(ctx context.Context, address string, opt
|
||||
grpc.FailOnNonTempDialError(true),
|
||||
}, opts...)
|
||||
|
||||
conn, err = grpc.DialContext(ctx, address, options...)
|
||||
timedCtx, cancel := context.WithTimeout(ctx, connWaitTimeout)
|
||||
defer cancel()
|
||||
|
||||
conn, err = grpc.DialContext(timedCtx, address, options...)
|
||||
if err == context.Canceled {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user