Copilot commented on code in PR #13034:
URL: https://github.com/apache/apisix/pull/13034#discussion_r2876427233
##########
apisix/utils/log-util.lua:
##########
@@ -433,4 +434,30 @@ function _M.get_rfc3339_zulu_timestamp(timestamp)
end
+function _M.check_and_read_req_body(conf, ctx)
+ if conf.include_req_body then
+ local should_read_body = true
+ if conf.include_req_body_expr then
+ if not conf.reques_expr then
+ local request_expr, err = expr.new(conf.include_req_body_expr)
+ if not request_expr then
+ core.log.error('generate request expr err ', err)
+ return
+ end
+ conf.request_expr = request_expr
+ end
Review Comment:
In `check_and_read_req_body`, the cache guard checks `conf.reques_expr`
(typo) but the compiled expression is stored in `conf.request_expr`. As
written, this will recompile the expression on every request when
`include_req_body_expr` is set, adding avoidable CPU overhead and repeatedly
mutating `conf`. Change the guard to check `conf.request_expr` (or store into
the same field you check).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]