From afe7175941854f737ab30edde4e8bafce90f916d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 18 Nov 2023 04:32:35 +0800 Subject: [PATCH] Update webstats_common.lua --- plugins/webstats/lua/webstats_common.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/webstats/lua/webstats_common.lua b/plugins/webstats/lua/webstats_common.lua index d3113a0ae..091f08bfd 100644 --- a/plugins/webstats/lua/webstats_common.lua +++ b/plugins/webstats/lua/webstats_common.lua @@ -240,6 +240,8 @@ function _M.get_http_origin(self) end function _M.cronPre(self) + self:lock_working('cron_init_stat') + local time_key = self:get_store_key() local time_key_next = self:get_store_key_with_time(ngx.time()+3600) @@ -272,6 +274,8 @@ function _M.cronPre(self) end end + self:unlock_working('cron_init_stat') + return true end @@ -317,6 +321,11 @@ function _M.cron(self) return true end + -- 初始化统计表时不执行 + if self:is_working('cron_init_stat') then + return true + end + local db = self:initDB(input_sn) stat_fields[input_sn] = {}