mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-30 20:31:01 +08:00
访问日志因尺寸过大无法提交到API节点时,自动去除requestBody后再次尝试
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
|
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
|
||||||
"github.com/TeaOSLab/EdgeNode/internal/rpc"
|
"github.com/TeaOSLab/EdgeNode/internal/rpc"
|
||||||
"github.com/TeaOSLab/EdgeNode/internal/utils"
|
"github.com/TeaOSLab/EdgeNode/internal/utils"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -109,6 +111,19 @@ Loop:
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否请求内容过大
|
||||||
|
statusCode, ok := status.FromError(err)
|
||||||
|
if ok && statusCode.Code() == codes.ResourceExhausted {
|
||||||
|
// 去除Body
|
||||||
|
for _, accessLog := range accessLogs {
|
||||||
|
accessLog.RequestBody = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新提交
|
||||||
|
_, err = this.rpcClient.HTTPAccessLogRPC.CreateHTTPAccessLogs(this.rpcClient.Context(), &pb.CreateHTTPAccessLogsRequest{HttpAccessLogs: accessLogs})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user