Skip to content

Commit

Permalink
buildctl: set max backoff delay to 1 second
Browse files Browse the repository at this point in the history
When combined with --wait, this ensures that we get a fast response
when the server eventually opens up for connections.

Signed-off-by: Justin Chadwell <me@jedevc.com>
  • Loading branch information
jedevc committed Jul 12, 2023
1 parent 0eafef8 commit 1aef766
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/buildctl/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/pkg/errors"
"github.com/urfave/cli"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
)

// ResolveClient resolves a client from CLI args
Expand Down Expand Up @@ -67,6 +69,12 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {

opts := []client.ClientOpt{client.WithFailFast()}

backoffConfig := backoff.DefaultConfig
backoffConfig.MaxDelay = 1 * time.Second
opts = append(opts, client.WithGRPCDialOption(
grpc.WithConnectParams(grpc.ConnectParams{Backoff: backoffConfig}),
))

ctx := CommandContext(c)

if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() {
Expand Down

0 comments on commit 1aef766

Please sign in to comment.