gRpc connection error on filer when no volume left #2243

fix https://github.com/chrislusf/seaweedfs/issues/2243

grpc do not cache connections only when connection problem happens.
Normal error results should not close the shared grpc connection.
This commit is contained in:
Chris Lu 2021-08-14 05:06:44 -07:00
parent 8126ab4b5d
commit 4909bd9684

View file

@ -119,9 +119,7 @@ func WithCachedGrpcClient(fn func(*grpc.ClientConn) error, address string, opts
} }
executionErr := fn(vgc.ClientConn) executionErr := fn(vgc.ClientConn)
if executionErr != nil { if executionErr != nil {
vgc.errCount++ if strings.Contains(executionErr.Error(), grpc.ErrServerStopped) ||
if vgc.errCount > 3 ||
strings.Contains(executionErr.Error(), "transport") ||
strings.Contains(executionErr.Error(), "connection closed") { strings.Contains(executionErr.Error(), "connection closed") {
grpcClientsLock.Lock() grpcClientsLock.Lock()
if t, ok := grpcClients[address]; ok { if t, ok := grpcClients[address]; ok {