From 024035943a394ddf2c6d761c8e93f65b43fab625 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 13 Apr 2022 19:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/errors.go | 4 +++- internal/rpc/rpc_utils.go | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/caches/errors.go b/internal/caches/errors.go index 42c10f4..cec18aa 100644 --- a/internal/caches/errors.go +++ b/internal/caches/errors.go @@ -12,6 +12,7 @@ var ( ErrEntityTooLarge = errors.New("entity too large") ErrWritingUnavailable = errors.New("writing unavailable") ErrWritingQueueFull = errors.New("writing queue full") + ErrTooManyOpenFiles = errors.New("too many open files") ) // CapacityError 容量错误 @@ -36,7 +37,8 @@ func CanIgnoreErr(err error) bool { if err == ErrFileIsWriting || err == ErrEntityTooLarge || err == ErrWritingUnavailable || - err == ErrWritingQueueFull { + err == ErrWritingQueueFull || + err == ErrTooManyOpenFiles { return true } _, ok := err.(*CapacityError) diff --git a/internal/rpc/rpc_utils.go b/internal/rpc/rpc_utils.go index abae6b6..0be403a 100644 --- a/internal/rpc/rpc_utils.go +++ b/internal/rpc/rpc_utils.go @@ -4,6 +4,7 @@ import ( "github.com/TeaOSLab/EdgeNode/internal/configs" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "strings" "sync" ) @@ -45,5 +46,9 @@ func IsConnError(err error) bool { return errorCode == codes.Unavailable || errorCode == codes.Canceled } + if strings.Contains(err.Error(), "code = Canceled") { + return true + } + return false }