From 21d11e9c9a6fd5fa2a5958861bf4577c95e8a6e6 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 15 Apr 2024 08:42:33 +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 --- .golangci.yaml | 3 ++- internal/caches/storage_memory.go | 5 +++++ internal/utils/fnv/hash_test.go | 4 ++-- internal/waf/requests/request.go | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 36908ff..8011bb4 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -72,4 +72,5 @@ linters: - whitespace - noctx - rowserrcheck - - tagliatelle \ No newline at end of file + - tagliatelle + - protogetter \ No newline at end of file diff --git a/internal/caches/storage_memory.go b/internal/caches/storage_memory.go index beee962..9dce30a 100644 --- a/internal/caches/storage_memory.go +++ b/internal/caches/storage_memory.go @@ -560,6 +560,11 @@ func (this *MemoryStorage) flushItem(fullKey string) { if !isInList { for i := 0; i < 1000; i++ { isInList, _, err = this.list.Exist(types.String(hash)) + if err != nil { + remotelogs.Error("CACHE", "flush items failed: "+err.Error()) + time.Sleep(1 * time.Second) + continue + } if isInList { break } diff --git a/internal/utils/fnv/hash_test.go b/internal/utils/fnv/hash_test.go index a311c09..b889f0f 100644 --- a/internal/utils/fnv/hash_test.go +++ b/internal/utils/fnv/hash_test.go @@ -18,7 +18,7 @@ func TestHash(t *testing.T) { func BenchmarkHashString(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { - fnv.HashString("abcdefh") + _ = fnv.HashString("abcdefh") } }) -} \ No newline at end of file +} diff --git a/internal/waf/requests/request.go b/internal/waf/requests/request.go index 6c4e53b..4bd57ea 100644 --- a/internal/waf/requests/request.go +++ b/internal/waf/requests/request.go @@ -39,7 +39,7 @@ type Request interface { WAFMaxRequestSize() int64 // Format 格式化变量 - Format(string) string + Format(varString string) string // ProcessResponseHeaders 处理响应Header ProcessResponseHeaders(headers http.Header, status int)