Skip to content

Commit a2d559b

Browse files
committed
add keepalive params to device-agents apiserver connection
1 parent 3df373a commit a2d559b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/device-agent/runtimeconfig/runtimeconfig.go

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"google.golang.org/grpc"
2929
"google.golang.org/grpc/codes"
3030
"google.golang.org/grpc/credentials/insecure"
31+
"google.golang.org/grpc/keepalive"
3132
grpcstatus "google.golang.org/grpc/status"
3233
)
3334

@@ -78,6 +79,11 @@ func (rc *runtimeConfig) DialAPIServer(ctx context.Context) (*grpc.ClientConn, e
7879
rc.apiServerGRPCAddress(),
7980
grpc.WithTransportCredentials(insecure.NewCredentials()),
8081
grpc.WithBlock(),
82+
grpc.WithKeepaliveParams(keepalive.ClientParameters{
83+
Time: time.Second * 10,
84+
Timeout: time.Second * 2,
85+
PermitWithoutStream: false,
86+
}),
8187
grpc.WithReturnConnectionError(),
8288
)
8389
}

0 commit comments

Comments
 (0)