mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 06:40:25 +08:00
优化代码
This commit is contained in:
@@ -73,3 +73,4 @@ linters:
|
|||||||
- noctx
|
- noctx
|
||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- tagliatelle
|
- tagliatelle
|
||||||
|
- protogetter
|
||||||
@@ -560,6 +560,11 @@ func (this *MemoryStorage) flushItem(fullKey string) {
|
|||||||
if !isInList {
|
if !isInList {
|
||||||
for i := 0; i < 1000; i++ {
|
for i := 0; i < 1000; i++ {
|
||||||
isInList, _, err = this.list.Exist(types.String(hash))
|
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 {
|
if isInList {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func TestHash(t *testing.T) {
|
|||||||
func BenchmarkHashString(b *testing.B) {
|
func BenchmarkHashString(b *testing.B) {
|
||||||
b.RunParallel(func(pb *testing.PB) {
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
for pb.Next() {
|
for pb.Next() {
|
||||||
fnv.HashString("abcdefh")
|
_ = fnv.HashString("abcdefh")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ type Request interface {
|
|||||||
WAFMaxRequestSize() int64
|
WAFMaxRequestSize() int64
|
||||||
|
|
||||||
// Format 格式化变量
|
// Format 格式化变量
|
||||||
Format(string) string
|
Format(varString string) string
|
||||||
|
|
||||||
// ProcessResponseHeaders 处理响应Header
|
// ProcessResponseHeaders 处理响应Header
|
||||||
ProcessResponseHeaders(headers http.Header, status int)
|
ProcessResponseHeaders(headers http.Header, status int)
|
||||||
|
|||||||
Reference in New Issue
Block a user