优化代码

This commit is contained in:
刘祥超
2024-04-15 08:42:33 +08:00
parent 0789b3d0d5
commit 4bdd248f99
4 changed files with 10 additions and 4 deletions
+2 -1
View File
@@ -72,4 +72,5 @@ linters:
- whitespace
- noctx
- rowserrcheck
- tagliatelle
- tagliatelle
- protogetter
+5
View File
@@ -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
}
+2 -2
View File
@@ -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")
}
})
}
}
+1 -1
View File
@@ -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)