This commit is contained in:
midoks
2023-02-11 05:24:53 +08:00
parent cc51d9501f
commit 4e35c34854
2 changed files with 9 additions and 4 deletions
+6 -4
View File
@@ -44,15 +44,17 @@ end
function _M.getInstance(self)
if rawget(self, "instance") == nil then
rawset(self, "instance", self:new())
if 0 == ngx.worker.id() then
self:cron()
end
end
assert(self.instance ~= nil)
return self.instance
end
function _M:initCron(self)
if 0 == ngx.worker.id() then
self:cron()
end
end
function _M.initDB(self)
local path = log_dir .. "/waf.db"
db, err = sqlite3.open(path)
+3
View File
@@ -15,6 +15,9 @@ local json = require "cjson"
local __C = require "common"
local C = __C:getInstance()
-- cron
C:initCron()
local function timer_stats_total_log(premature)
C:timer_stats_total()
end