aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-29 21:43:51 +0200
committerKim Alvefur <zash@zash.se>2020-06-29 21:43:51 +0200
commit5bafaaa5d711a6e7995f23e931c7b26f6f1b28c3 (patch)
tree80697dc1d3edea1bb44461270075bb9eec416589
parent55eb4ad93fe0cf0103efdfe5c9e77004c00ecd15 (diff)
downloadprosody-5bafaaa5d711a6e7995f23e931c7b26f6f1b28c3.tar.gz
prosody-5bafaaa5d711a6e7995f23e931c7b26f6f1b28c3.zip
mod_admin_shell: Fix debug:timers to handle net.server native timers
-rw-r--r--plugins/mod_admin_shell.lua22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 8f966e6e..89e4049f 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1269,14 +1269,24 @@ function def_env.debug:timers()
local h, params = add_task.h, add_task.params;
if h then
print("-- util.timer");
+ elseif server.timer then
+ print("-- net.server.timer");
+ h = server.timer.add_task.timers;
+ end
+ if h then
for i, id in ipairs(h.ids) do
- if not params[id] then
- print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id]);
- elseif not params[id].callback then
- print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id], unpack(params[id]));
- else
- print(os.date("%F %T", math.floor(h.priorities[i])), params[id].callback, unpack(params[id]));
+ local t, cb = h.priorities[i], h.items[id];
+ if not params then
+ local param = cb.param;
+ if param then
+ cb = param.callback;
+ else
+ cb = cb.timer_callback or cb;
+ end
+ elseif params[id] then
+ cb = params[id].callback or cb;
end
+ print(os.date("%F %T", math.floor(t)), cb);
end
end
if server.event_base then