Skip to content

Commit

Permalink
fix: keep alive enforcement policy (#499)
Browse files Browse the repository at this point in the history
* fix: keep alive enforcement policy

* fix: half min
  • Loading branch information
grutt committed May 15, 2024
1 parent 63c0b0c commit 0ffc3e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/services/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ func (s *Server) startGRPC() (func() error, error) {
recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(grpcPanicRecoveryHandler)),
))

var enforcement = keepalive.EnforcementPolicy{
MinTime: 5 * time.Second,
PermitWithoutStream: true,
}

serverOpts = append(serverOpts, grpc.KeepaliveEnforcementPolicy(enforcement))

var kasp = keepalive.ServerParameters{
// ping the client every 30 seconds if idle to ensure the connection is still active
Time: 30 * time.Second,
Expand Down

0 comments on commit 0ffc3e9

Please sign in to comment.