Skip to content

Commit

Permalink
feat: set keepalive enforcement policies (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse authored Jan 17, 2025
1 parent 75e5fa9 commit 77ac423
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package main
import (
"log"
"net"
"time"

"github.com/breez/data-sync/config"
"github.com/breez/data-sync/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
)

func main() {
Expand All @@ -33,7 +35,12 @@ func main() {
}

func CreateServer(config *config.Config, listener net.Listener, syncServer proto.SyncerServer) *grpc.Server {
s := grpc.NewServer()
s := grpc.NewServer(
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: time.Second * 5,
PermitWithoutStream: true,
}),
)
proto.RegisterSyncerServer(s, syncServer)
return s
}

0 comments on commit 77ac423

Please sign in to comment.