Skip to content

Commit

Permalink
add keepalive enforcement policy in apiserver
Browse files Browse the repository at this point in the history
  • Loading branch information
sechmann committed Feb 19, 2024
1 parent a2d559b commit a585e7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/apiserver/main.go
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ import (
kolidepb "github.com/nais/kolide-event-handler/pkg/pb"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
)

const (
@@ -257,7 +258,11 @@ func run(log *logrus.Entry, cfg config.Config) error {
sessions,
)

grpcServer := grpc.NewServer()
opts := []grpc.ServerOption{
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{MinTime: 9 * time.Second}),
}

grpcServer := grpc.NewServer(opts...)
pb.RegisterAPIServerServer(grpcServer, grpcHandler)

grpcListener, err := net.Listen("tcp", cfg.GRPCBindAddress)

0 comments on commit a585e7d

Please # to comment.