aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-23 21:52:07 +0100
committerKim Alvefur <zash@zash.se>2021-03-23 21:52:07 +0100
commit2ae58ee422d6ed8aee0efe99139c5b19790d104f (patch)
tree8ac13f7ae415fc8bb8c7a433cadaa1d00d856125 /plugins
parentf7cfe660cd0e13759a5231638b3dc0a21b8b9dc2 (diff)
downloadprosody-2ae58ee422d6ed8aee0efe99139c5b19790d104f.tar.gz
prosody-2ae58ee422d6ed8aee0efe99139c5b19790d104f.zip
mod_admin_shell: Sort timers by time in debug:timers()
Easier to see which timers are happening soon vs further in the future if they are in some sensible order.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_shell.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 04143cc9..18f075b8 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1307,6 +1307,7 @@ function def_env.debug:timers()
normalize_time = server.timer.to_absolute_time or normalize_time;
end
if h then
+ local timers = {};
for i, id in ipairs(h.ids) do
local t, cb = h.priorities[i], h.items[id];
if not params then
@@ -1319,7 +1320,11 @@ function def_env.debug:timers()
elseif params[id] then
cb = params[id].callback or cb;
end
- print(format_time(t), cb);
+ table.insert(timers, { format_time(t), cb });
+ end
+ table.sort(timers, function (a, b) return a[1] < b[1] end);
+ for _, t in ipairs(timers) do
+ print(t[1], t[2])
end
end
if server.event_base then