优化代码

This commit is contained in:
GoEdgeLab
2024-05-03 15:31:40 +08:00
parent 6db792a7c9
commit d839d81ea7
14 changed files with 117 additions and 111 deletions

View File

@@ -16,7 +16,7 @@ import (
"github.com/TeaOSLab/EdgeNode/internal/goman"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"github.com/TeaOSLab/EdgeNode/internal/rpc"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/TeaOSLab/EdgeNode/internal/utils/bytepool"
connutils "github.com/TeaOSLab/EdgeNode/internal/utils/conns"
"github.com/iwind/TeaGo/Tea"
"io"
@@ -246,9 +246,9 @@ func (this *HTTPCacheTaskManager) fetchKey(key *pb.HTTPCacheTaskKey) error {
}
// 读取内容,以便于生成缓存
var buf = utils.BytePool16k.Get()
var buf = bytepool.Pool16k.Get()
_, err = io.CopyBuffer(io.Discard, resp.Body, buf.Bytes)
utils.BytePool16k.Put(buf)
bytepool.Pool16k.Put(buf)
if err != nil {
if err != io.EOF {
err = this.simplifyErr(err)