shreemaan-abhishek commented on code in PR #11310:
URL: https://github.com/apache/apisix/pull/11310#discussion_r1775129900
##########
apisix/plugins/log-rotate.lua:
##########
@@ -299,9 +303,9 @@ local function rotate()
elseif max_size > 0 then
local access_log_file_size =
file_size(default_logs[DEFAULT_ACCESS_LOG_FILENAME].file)
local error_log_file_size =
file_size(default_logs[DEFAULT_ERROR_LOG_FILENAME].file)
- local files = core.table.new(2, 0)
+ local files = {}
Review Comment:
why make this change? It seems unrelated to me. If it really is, you should
remove it.
##########
apisix/plugins/log-rotate.lua:
##########
@@ -315,6 +319,11 @@ end
function _M.init()
+ if not local_conf then
+ local_conf = core.config.local_conf()
+ end
+ local nginx_config = local_conf and local_conf.nginx_config
Review Comment:
you can use core.table.try_read_attr() function instead. It's much cleaner.
##########
apisix/plugins/log-rotate.lua:
##########
@@ -76,7 +77,6 @@ end
local function get_log_path_info(file_type)
- local_conf = core.config.local_conf()
Review Comment:
why remove this line?
##########
apisix/plugins/log-rotate.lua:
##########
@@ -210,7 +210,7 @@ local function rotate_file(files, now_time, max_kept,
timeout)
return
end
- local new_files = core.table.new(2, 0)
+ local new_files = core.table.new(#files, 0)
Review Comment:
seems like unrelated change.
--
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]