This is an automated email from the ASF dual-hosted git repository.
monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 7449e16f4 perf(core): optmize "response.exit" (#10090)
7449e16f4 is described below
commit 7449e16f40f7d789bfdd6c3e01f29dfc07d37003
Author: Ruidong-X <[email protected]>
AuthorDate: Tue Sep 12 22:16:17 2023 +0800
perf(core): optmize "response.exit" (#10090)
---
apisix/core/response.lua | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/apisix/core/response.lua b/apisix/core/response.lua
index cfbac1467..04430abd5 100644
--- a/apisix/core/response.lua
+++ b/apisix/core/response.lua
@@ -70,7 +70,9 @@ function resp_exit(code, ...)
error("failed to encode data: " .. err, -2)
else
idx = idx + 1
- t[idx] = body .. "\n"
+ t[idx] = body
+ idx = idx + 1
+ t[idx] = "\n"
end
elseif v ~= nil then
@@ -80,7 +82,7 @@ function resp_exit(code, ...)
end
if idx > 0 then
- ngx_print(concat_tab(t, "", 1, idx))
+ ngx_print(t)
end
if code then