client: Respect client.WithTimeout
option
Fix the gRPC client dialer not using the timeout passed by the containerd client timeout option. Commit63b4688175
replaced the usage of deprecated `grpc.DialContext` with `grpc.NewClient`. However, the `dialer.ContextDialer` relied on the context deadline to propagate the timeout:388fb336b0/vendor/google.golang.org/grpc/clientconn.go (L216)
This assumption is now broken, because `grpc.NewClient` doesn't do any initial connection and defers it to the first RPC usage. This commit passes the timeout via the `MinConnectTimeout` grpc connection param, which will be applied to **every** connection attempt (not just the first). Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
76db0585af
commit
6b5efba83b
@ -130,6 +130,7 @@ func New(address string, opts ...Opt) (*Client, error) {
|
||||
backoffConfig.MaxDelay = copts.timeout
|
||||
connParams := grpc.ConnectParams{
|
||||
Backoff: backoffConfig,
|
||||
MinConnectTimeout: copts.timeout,
|
||||
}
|
||||
gopts := []grpc.DialOption{
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
|
Loading…
Reference in New Issue
Block a user