Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 3bcc551

Browse files
authored
Merge pull request #59 from YiannisGkoufas/backoff-increase
backoff increase
2 parents 07ec977 + 7591e6d commit 3bcc551

File tree

1 file changed

+12
-4
lines changed
  • container-object-storage-interface-provisioner-sidecar/pkg/provisioner

1 file changed

+12
-4
lines changed

Diff for: container-object-storage-interface-provisioner-sidecar/pkg/provisioner/provisioner.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package provisioner
1717

1818
import (
1919
"context"
20+
"google.golang.org/grpc/backoff"
2021
"net/url"
2122
"time"
2223

@@ -28,16 +29,21 @@ import (
2829
)
2930

3031
const (
31-
maxGrpcBackoff = 30 * time.Second
32+
maxGrpcBackoff = 5 * 30 * time.Second
3233
grpcDialTimeout = 30 * time.Second
3334
)
3435

3536
func NewDefaultCOSIProvisionerClient(ctx context.Context, address string, debug bool) (*COSIProvisionerClient, error) {
37+
backoffConfiguration := backoff.DefaultConfig
38+
backoffConfiguration.MaxDelay = maxGrpcBackoff
39+
3640
dialOpts := []grpc.DialOption{
3741
grpc.WithInsecure(), // strictly restricting to local Unix domain socket
38-
grpc.WithBackoffMaxDelay(maxGrpcBackoff),
42+
grpc.WithConnectParams(grpc.ConnectParams{
43+
Backoff: backoffConfiguration,
44+
MinConnectTimeout: grpcDialTimeout,
45+
}),
3946
grpc.WithBlock(), // block until connection succeeds
40-
grpc.WithTimeout(grpcDialTimeout),
4147
}
4248

4349
interceptors := []grpc.UnaryClientInterceptor{}
@@ -65,12 +71,14 @@ func NewCOSIProvisionerClient(ctx context.Context, address string, dialOpts []gr
6571
dialOpts = append(dialOpts, grpc.WithChainUnaryInterceptor(interceptor))
6672
}
6773

74+
ctx, cancel := context.WithTimeout(ctx, maxGrpcBackoff)
75+
defer cancel()
76+
6877
conn, err := grpc.DialContext(ctx, address, dialOpts...)
6978
if err != nil {
7079
klog.ErrorS(err, "Connection failed", "address", address)
7180
return nil, err
7281
}
73-
7482
return &COSIProvisionerClient{
7583
address: address,
7684
conn: conn,

0 commit comments

Comments
 (0)