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 8
8
"net/url"
9
9
"os"
10
10
"strings"
11
+ "time"
11
12
12
13
contentapi "github.com/containerd/containerd/api/services/content/v1"
13
14
"github.com/containerd/containerd/defaults"
@@ -186,16 +187,29 @@ func (c *Client) Dialer() session.Dialer {
186
187
}
187
188
188
189
func (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 :
193
199
// only buildkit v0.11+ supports the info api, but an unimplemented
194
200
// response error is still a response so we can ignore it
195
201
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 ):
196
210
}
211
+ c .conn .ResetConnectBackoff ()
197
212
}
198
- return err
199
213
}
200
214
201
215
func (c * Client ) Close () error {
Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ import (
16
16
"github.com/pkg/errors"
17
17
"github.com/urfave/cli"
18
18
"go.opentelemetry.io/otel/trace"
19
- "google.golang.org/grpc"
20
- "google.golang.org/grpc/backoff"
21
19
)
22
20
23
21
// ResolveClient resolves a client from CLI args
@@ -69,12 +67,6 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {
69
67
70
68
opts := []client.ClientOpt {client .WithFailFast ()}
71
69
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
-
78
70
ctx := CommandContext (c )
79
71
80
72
if span := trace .SpanFromContext (ctx ); span .SpanContext ().IsValid () {
You can’t perform that action at this time.
0 commit comments