From 2ca859867140c5a51d171f765ef14348ba13e018 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 11 Feb 2023 06:04:55 +0800 Subject: [PATCH] up --- plugins/op_waf/waf/lua/init_worker.lua | 3 --- plugins/op_waf/waf/lua/waf_common.lua | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/op_waf/waf/lua/init_worker.lua b/plugins/op_waf/waf/lua/init_worker.lua index eabcdd451..ef406b3c2 100644 --- a/plugins/op_waf/waf/lua/init_worker.lua +++ b/plugins/op_waf/waf/lua/init_worker.lua @@ -15,9 +15,6 @@ local json = require "cjson" local __C = require "waf_common" local C = __C:getInstance() --- cron -C:initCron() - local function timer_stats_total_log(premature) C:timer_stats_total() end diff --git a/plugins/op_waf/waf/lua/waf_common.lua b/plugins/op_waf/waf/lua/waf_common.lua index 09a2fa527..b658c4ccc 100644 --- a/plugins/op_waf/waf/lua/waf_common.lua +++ b/plugins/op_waf/waf/lua/waf_common.lua @@ -42,8 +42,9 @@ end function _M.getInstance(self) - if rawget(self, "instance") == nil then - rawset(self, "instance", self:new()) + if self.instance == nil then + self.instance = self:new() + self.instance:initCron() end assert(self.instance ~= nil) return self.instance