From 15c60cbb2660d60d2714d3386731044fcfeac473 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 7 Feb 2021 03:50:01 -0800 Subject: [PATCH] close the grpc connection after 10 hours related to https://github.com/chrislusf/seaweedfs/issues/1782 --- weed/pb/grpc_client_server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go index 4d78d769f..9ffda9b04 100644 --- a/weed/pb/grpc_client_server.go +++ b/weed/pb/grpc_client_server.go @@ -35,8 +35,9 @@ func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server { var options []grpc.ServerOption options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{ - Time: 10 * time.Second, // wait time before ping if no activity - Timeout: 20 * time.Second, // ping timeout + Time: 10 * time.Second, // wait time before ping if no activity + Timeout: 20 * time.Second, // ping timeout + MaxConnectionAge: 10 * time.Hour, }), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ MinTime: 60 * time.Second, // min time a client should wait before sending a ping