File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 88 "net/url"
99 "os"
1010 "strings"
11+ "time"
1112
1213 contentapi "github.com/containerd/containerd/api/services/content/v1"
1314 "github.com/containerd/containerd/defaults"
@@ -186,16 +187,29 @@ func (c *Client) Dialer() session.Dialer {
186187}
187188
188189func (c * Client ) Wait (ctx context.Context ) error {
189- opts := []grpc.CallOption {grpc .WaitForReady (true )}
190- _ , err := c .ControlClient ().Info (ctx , & controlapi.InfoRequest {}, opts ... )
191- if err != nil {
192- if code := grpcerrors .Code (err ); code == codes .Unimplemented {
190+ for {
191+ _ , err := c .ControlClient ().Info (ctx , & controlapi.InfoRequest {})
192+ if err == nil {
193+ return nil
194+ }
195+
196+ switch code := grpcerrors .Code (err ); code {
197+ case codes .Unavailable :
198+ case codes .Unimplemented :
193199 // only buildkit v0.11+ supports the info api, but an unimplemented
194200 // response error is still a response so we can ignore it
195201 return nil
202+ default :
203+ return err
204+ }
205+
206+ select {
207+ case <- ctx .Done ():
208+ return ctx .Err ()
209+ case <- time .After (time .Second ):
196210 }
211+ c .conn .ResetConnectBackoff ()
197212 }
198- return err
199213}
200214
201215func (c * Client ) Close () error {
Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ import (
1616 "github.com/pkg/errors"
1717 "github.com/urfave/cli"
1818 "go.opentelemetry.io/otel/trace"
19- "google.golang.org/grpc"
20- "google.golang.org/grpc/backoff"
2119)
2220
2321// ResolveClient resolves a client from CLI args
@@ -69,12 +67,6 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {
6967
7068 opts := []client.ClientOpt {client .WithFailFast ()}
7169
72- backoffConfig := backoff .DefaultConfig
73- backoffConfig .MaxDelay = 1 * time .Second
74- opts = append (opts , client .WithGRPCDialOption (
75- grpc .WithConnectParams (grpc.ConnectParams {Backoff : backoffConfig }),
76- ))
77-
7870 ctx := CommandContext (c )
7971
8072 if span := trace .SpanFromContext (ctx ); span .SpanContext ().IsValid () {
You can’t perform that action at this time.
0 commit comments