diff --git a/plugins/webstats/lua/webstats_common.lua b/plugins/webstats/lua/webstats_common.lua index 1ba56dcdd..8858a55eb 100644 --- a/plugins/webstats/lua/webstats_common.lua +++ b/plugins/webstats/lua/webstats_common.lua @@ -45,6 +45,7 @@ end function _M.getInstance(self) if rawget(self, "instance") == nil then rawset(self, "instance", self.new()) + self.cron() end assert(self.instance ~= nil) return self.instance @@ -474,8 +475,7 @@ function _M.cron(self) ngx.update_time() -- self:D("PID:"..tostring(ngx.worker.id()).."--【"..tostring(llen).."】, elapsed: " .. tostring(ngx.now() - begin)) end - - ngx.timer.every(1, timer_every_get_data) + ngx.timer.every(0.5, timer_every_get_data) end diff --git a/plugins/webstats/lua/webstats_worker.lua b/plugins/webstats/lua/webstats_worker.lua index 2eda941e6..53a4b0d8c 100644 --- a/plugins/webstats/lua/webstats_worker.lua +++ b/plugins/webstats/lua/webstats_worker.lua @@ -17,5 +17,4 @@ end if ngx.worker.id() == 0 then ngx.timer.every(60, webstats_cron_pre) - WS_C:cron() end \ No newline at end of file