From 8dd80e5f47ccf220ab234401e635889ac208901e Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 2 May 2024 13:40:26 -0700 Subject: [PATCH 1/2] Allow for more frequent keepalives --- pkg/api/server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/api/server.go b/pkg/api/server.go index b356feb6..a5aab4e1 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -26,6 +26,7 @@ import ( "github.com/xmtp/xmtp-node-go/pkg/tracing" "google.golang.org/grpc/health" healthgrpc "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/keepalive" "go.uber.org/zap" "google.golang.org/grpc" @@ -141,6 +142,12 @@ func (s *Server) startGRPC() error { grpc.Creds(insecure.NewCredentials()), grpc.UnaryInterceptor(middleware.ChainUnaryServer(unary...)), grpc.StreamInterceptor(middleware.ChainStreamServer(stream...)), + grpc.KeepaliveParams(keepalive.ServerParameters{ + Time: 5 * time.Minute, + }), + grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: 15 * time.Second, + }), grpc.MaxRecvMsgSize(s.Config.Options.MaxMsgSize), } grpcServer := grpc.NewServer(options...) From 79d3939e73442c5fb229d646d9b48ec730b9ee5b Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 2 May 2024 13:42:43 -0700 Subject: [PATCH 2/2] Remove server parameter --- pkg/api/server.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/api/server.go b/pkg/api/server.go index a5aab4e1..c14351eb 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -142,9 +142,6 @@ func (s *Server) startGRPC() error { grpc.Creds(insecure.NewCredentials()), grpc.UnaryInterceptor(middleware.ChainUnaryServer(unary...)), grpc.StreamInterceptor(middleware.ChainStreamServer(stream...)), - grpc.KeepaliveParams(keepalive.ServerParameters{ - Time: 5 * time.Minute, - }), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ MinTime: 15 * time.Second, }),