Skip to content

Commit

Permalink
Add gRPC keepalive parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
peterebden committed Jul 23, 2024
1 parent a353393 commit ffbc425
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 11.11.1
---------------
* Add keepalive config to gRPC dial parameters

Version 11.11.0
---------------
* Add a gRPC API to Lucidity which can be used to programmatically retrieve workers
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.11.0
11.11.1
1 change: 1 addition & 0 deletions grpcutil/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ go_library(
"///third_party/go/google.golang.org_grpc//grpclog",
"///third_party/go/google.golang.org_grpc//health",
"///third_party/go/google.golang.org_grpc//health/grpc_health_v1",
"///third_party/go/google.golang.org_grpc//keepalive",
"///third_party/go/google.golang.org_grpc//metadata",
"///third_party/go/google.golang.org_grpc//reflection",
"///third_party/go/gopkg.in_op_go-logging.v1//:go-logging.v1",
Expand Down
6 changes: 6 additions & 0 deletions grpcutil/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"crypto/x509"
"io/ioutil"
"strings"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
)

// Dial is a convenience function wrapping up some common gRPC functionality.
Expand All @@ -22,6 +24,10 @@ func Dial(address string, tls bool, caFile, tokenFile string) (*grpc.ClientConn,
func DialOptions(tokenFile string) []grpc.DialOption {
opts := []grpc.DialOption{
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)),
grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 20 * time.Second,
Timeout: 20 * time.Second,
}),
}
if tokenFile == "" {
return opts
Expand Down

0 comments on commit ffbc425

Please sign in to comment.