From d1dcdd4f255c5e1aadd7e13ee6a687f5ce18a477 Mon Sep 17 00:00:00 2001 From: dami Date: Sun, 5 Jul 2026 03:58:34 +0800 Subject: [PATCH] Update webstats_common.lua --- plugins/webstats/lua/webstats_common.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/webstats/lua/webstats_common.lua b/plugins/webstats/lua/webstats_common.lua index d43c37aa8..8141a4488 100644 --- a/plugins/webstats/lua/webstats_common.lua +++ b/plugins/webstats/lua/webstats_common.lua @@ -92,6 +92,9 @@ function _M.getInstance(self) end function _M.start_cron(self) + if ngx.worker.id() ~= 0 then + return + end self:cron() end @@ -468,10 +471,6 @@ end 7. 提交事务并关闭连接 ]] function _M.cron(self) - if ngx.worker.id() ~= 0 then - return - end - --[[ 定时任务核心处理函数 @param premature boolean 是否为定时器提前触发