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),
|
grpc.FailOnNonTempDialError(true),
|
||||||
}, opts...)
|
}, opts...)
|
||||||
|
|
||||||
timedCtx, cf := context.WithTimeout(ctx, connWaitTimeout)
|
timedCtx, cancel := context.WithTimeout(ctx, connWaitTimeout)
|
||||||
defer cf()
|
defer cancel()
|
||||||
|
|
||||||
conn, err = grpc.DialContext(timedCtx, node.GetAddress().Address, options...)
|
conn, err = grpc.DialContext(timedCtx, node.GetAddress().Address, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -98,7 +98,10 @@ func (transport *Transport) DialAddress(ctx context.Context, address string, opt
|
|||||||
grpc.FailOnNonTempDialError(true),
|
grpc.FailOnNonTempDialError(true),
|
||||||
}, opts...)
|
}, 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 {
|
if err == context.Canceled {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user