Skip to content

Commit a585e7d

Browse files
committed
add keepalive enforcement policy in apiserver
1 parent a2d559b commit a585e7d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/apiserver/main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
kolidepb "github.com/nais/kolide-event-handler/pkg/pb"
3232
"github.com/sirupsen/logrus"
3333
"google.golang.org/grpc"
34+
"google.golang.org/grpc/keepalive"
3435
)
3536

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

260-
grpcServer := grpc.NewServer()
261+
opts := []grpc.ServerOption{
262+
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{MinTime: 9 * time.Second}),
263+
}
264+
265+
grpcServer := grpc.NewServer(opts...)
261266
pb.RegisterAPIServerServer(grpcServer, grpcHandler)
262267

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

0 commit comments

Comments
 (0)