From fb94fb83048f684daa67eb2a35532681be3915f3 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 20 Oct 2022 16:31:30 +0800 Subject: [PATCH] up --- class/core/mw.py | 9 +++++++-- plugins/webstats/index.py | 9 +++++---- plugins/webstats/lua/webstats_common.lua | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/class/core/mw.py b/class/core/mw.py index bad73aa9d..489736467 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -161,19 +161,24 @@ def isInstalledWeb(): def restartWeb(): + return opWeb("reload") + + +def opWeb(method): if not isInstalledWeb(): return False # systemd systemd = '/lib/systemd/system/openresty.service' if os.path.exists(systemd): - execShell('systemctl reload openresty') + execShell('systemctl ' + method + ' openresty') return True # initd initd = getServerDir() + '/openresty/init.d/openresty' + if os.path.exists(initd): - execShell(initd + ' ' + 'reload') + execShell(initd + ' ' + method) return True return False diff --git a/plugins/webstats/index.py b/plugins/webstats/index.py index f0232c384..39bdd0a61 100755 --- a/plugins/webstats/index.py +++ b/plugins/webstats/index.py @@ -236,7 +236,7 @@ def start(): if not mw.isAppleSystem(): mw.execShell("chown -R www:www " + getServerDir()) - mw.restartWeb() + mw.opWeb("reload") return 'ok' @@ -247,14 +247,14 @@ def stop(): import tool_task tool_task.removeBgTask() - mw.restartWeb() + mw.opWeb("restart") return 'ok' def restart(): initDreplace() - mw.restartWeb() + mw.opWeb("reload") return 'ok' @@ -262,7 +262,8 @@ def reload(): initDreplace() loadDebugLogFile() - mw.restartWeb() + + mw.opWeb("reload") return 'ok' diff --git a/plugins/webstats/lua/webstats_common.lua b/plugins/webstats/lua/webstats_common.lua index 0fe7d8344..04f697784 100644 --- a/plugins/webstats/lua/webstats_common.lua +++ b/plugins/webstats/lua/webstats_common.lua @@ -220,6 +220,7 @@ function _M.cron(self) local timer_every_get_data = function (premature) local llen, _ = ngx.shared.mw_total:llen(total_key) + -- self:D("llen:"..tostring(llen)) if llen == 0 then return true end @@ -443,7 +444,7 @@ function _M.cron(self) self:unlock_working(cron_key) - -- ngx.update_time() + ngx.update_time() -- self:D("--【"..tostring(llen).."】, elapsed: " .. tostring(ngx.now() - begin)) end