Update webstats_common.lua

This commit is contained in:
dami
2026-07-04 22:56:49 +08:00
parent 01ac598e39
commit 9f864b3407
+24 -2
View File
@@ -717,11 +717,33 @@ function _M.cron(self)
function timer_every_get_data_try()
local presult, err = pcall( function() timer_every_get_data() end)
local presult, err = pcall(function() timer_every_get_data() end)
if not presult then
self:D("debug cron error on :"..tostring(err))
self:D("debug cron error on :" .. tostring(err))
return true
end
end
function timer_every_get_data_try_debug()
local start_time = ngx.now()
local start_llen = ngx.shared.mw_total:llen(total_key)
local presult, err = pcall(function() timer_every_get_data() end)
local end_time = ngx.now()
local end_llen = ngx.shared.mw_total:llen(total_key)
local duration = (end_time - start_time) * 1000
if not presult then
self:D("debug cron error on :" .. tostring(err))
return true
end
if start_llen > 0 then
self:D(string.format("cron process: took %.2fms, processed %d records, remaining %d records",
duration, start_llen - end_llen, end_llen))
end
end
ngx.timer.every(0.1, timer_every_get_data_try)