diff --git a/internal/nodes/http_access_log_queue.go b/internal/nodes/http_access_log_queue.go index 6fb0029..cfae612 100644 --- a/internal/nodes/http_access_log_queue.go +++ b/internal/nodes/http_access_log_queue.go @@ -7,6 +7,8 @@ import ( "github.com/TeaOSLab/EdgeNode/internal/remotelogs" "github.com/TeaOSLab/EdgeNode/internal/rpc" "github.com/TeaOSLab/EdgeNode/internal/utils" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "strings" "time" ) @@ -109,6 +111,19 @@ Loop: 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 }