From 9b84f9e24d36557443a36ddbca45078192913a9d Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 2 May 2024 13:53:03 -0700 Subject: [PATCH] Allow for more frequent keepalives (#387) * Allow for more frequent keepalives * Remove server parameter --- pkg/api/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/api/server.go b/pkg/api/server.go index b356feb6..c14351eb 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,9 @@ func (s *Server) startGRPC() error { grpc.Creds(insecure.NewCredentials()), grpc.UnaryInterceptor(middleware.ChainUnaryServer(unary...)), grpc.StreamInterceptor(middleware.ChainStreamServer(stream...)), + grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: 15 * time.Second, + }), grpc.MaxRecvMsgSize(s.Config.Options.MaxMsgSize), } grpcServer := grpc.NewServer(options...)