Browse Source
Fix: relax gRPC server keepalive enforcement to 20s (#7898 )
* Fix: relax gRPC server keepalive enforcement to 20s to prevent 'too_many_pings' errors
* Refactor: introduce GrpcKeepAliveMinimumTime constant for clarity
pull/7900/head
Chris Lu
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
4 additions and
3 deletions
weed/pb/grpc_client_server.go
@ -33,8 +33,9 @@ const (
Max_Message_Size = 1 << 30 // 1 GB
// gRPC keepalive settings - must be consistent between client and server
GrpcKeepAliveTime = 60 * time . Second // ping interval when no activity
GrpcKeepAliveTimeout = 20 * time . Second // ping timeout
GrpcKeepAliveTime = 60 * time . Second // ping interval when no activity
GrpcKeepAliveTimeout = 20 * time . Second // ping timeout
GrpcKeepAliveMinimumTime = 20 * time . Second // minimum interval between client pings (enforcement)
)
var (
@ -62,7 +63,7 @@ func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
Timeout : GrpcKeepAliveTimeout , // ping timeout
} ) ,
grpc . KeepaliveEnforcementPolicy ( keepalive . EnforcementPolicy {
MinTime : GrpcKeepAliveTime , // min time a client should wait before sending a ping
MinTime : GrpcKeepAliveMinimum Time , // min time a client should wait before sending a ping
PermitWithoutStream : true ,
} ) ,
grpc . MaxRecvMsgSize ( Max_Message_Size ) ,