diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-04 10:19:32 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-04 10:19:32 +0300 |
commit | 2b3de6c320eebe5f3750037b58fea33551f997eb (patch) | |
tree | 25171f41ea223b92787cd1f88311d0925e3b93e1 | |
parent | 3509ce8bc9d854b77df7886c663ec6dfca928217 (diff) | |
parent | 5d99a81b63587f8cbf7d18ce17f6bbb093376c23 (diff) |
Merge branch 'pks-praefect-keepalive-policy' into 'master'
Fix stale connections to Praefect due to keepalive policy
See merge request gitlab-org/gitaly!2511
-rw-r--r-- | changelogs/unreleased/pks-praefect-keepalive-policy.yml | 5 | ||||
-rw-r--r-- | internal/praefect/server.go | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/changelogs/unreleased/pks-praefect-keepalive-policy.yml b/changelogs/unreleased/pks-praefect-keepalive-policy.yml new file mode 100644 index 000000000..e3e5c9ebe --- /dev/null +++ b/changelogs/unreleased/pks-praefect-keepalive-policy.yml @@ -0,0 +1,5 @@ +--- +title: Fix stale connections to Praefect due to keepalive policy +merge_request: 2511 +author: +type: fixed diff --git a/internal/praefect/server.go b/internal/praefect/server.go index 7965fbb92..757a46784 100644 --- a/internal/praefect/server.go +++ b/internal/praefect/server.go @@ -3,6 +3,8 @@ calls to a set of Gitaly services.*/ package praefect import ( + "time" + grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags" @@ -30,6 +32,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/health" healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/keepalive" ) // NewGRPCServer returns gRPC server with registered proxy-handler and actual services praefect serves on its own. @@ -81,6 +84,10 @@ func NewGRPCServer( // converted to errors and logged panichandler.UnaryPanicHandler, )), + grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: 20 * time.Second, + PermitWithoutStream: true, + }), }...) warnDupeAddrs(logger, conf) |