Skip to content

Commit

Permalink
csi: clarify gRPC connect timeout parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Feb 11, 2022
1 parent 4afc67b commit 787acdf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/csi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ func NewClient(addr string, logger hclog.Logger) (CSIPlugin, error) {
}

func newGrpcConn(addr string, logger hclog.Logger) (*grpc.ClientConn, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
// after DialContext returns w/ initial connection, closing this
// context is a no-op
connectCtx, cancel := context.WithTimeout(context.Background(), time.Second*1)
defer cancel()
conn, err := grpc.DialContext(
ctx,
connectCtx,
addr,
grpc.WithBlock(),
grpc.WithInsecure(),
Expand Down

0 comments on commit 787acdf

Please sign in to comment.