Comparison

plugins/mod_admin_shell.lua @ 10986:d585deb8c882

mod_admin_shell: Fix debug:timers to handle net.server native timers
author Kim Alvefur <zash@zash.se>
date Mon, 29 Jun 2020 21:43:51 +0200
parent 10929:ad5e373b1419
child 10988:9dcbbb1d12c3
comparison
equal deleted inserted replaced
10985:758ce12586de 10986:d585deb8c882
1267 local print = self.session.print; 1267 local print = self.session.print;
1268 local add_task = require"util.timer".add_task; 1268 local add_task = require"util.timer".add_task;
1269 local h, params = add_task.h, add_task.params; 1269 local h, params = add_task.h, add_task.params;
1270 if h then 1270 if h then
1271 print("-- util.timer"); 1271 print("-- util.timer");
1272 elseif server.timer then
1273 print("-- net.server.timer");
1274 h = server.timer.add_task.timers;
1275 end
1276 if h then
1272 for i, id in ipairs(h.ids) do 1277 for i, id in ipairs(h.ids) do
1273 if not params[id] then 1278 local t, cb = h.priorities[i], h.items[id];
1274 print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id]); 1279 if not params then
1275 elseif not params[id].callback then 1280 local param = cb.param;
1276 print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id], unpack(params[id])); 1281 if param then
1277 else 1282 cb = param.callback;
1278 print(os.date("%F %T", math.floor(h.priorities[i])), params[id].callback, unpack(params[id])); 1283 else
1279 end 1284 cb = cb.timer_callback or cb;
1285 end
1286 elseif params[id] then
1287 cb = params[id].callback or cb;
1288 end
1289 print(os.date("%F %T", math.floor(t)), cb);
1280 end 1290 end
1281 end 1291 end
1282 if server.event_base then 1292 if server.event_base then
1283 local count = 0; 1293 local count = 0;
1284 for _, v in pairs(debug.getregistry()) do 1294 for _, v in pairs(debug.getregistry()) do