Comparison

plugins/mod_debug_reset.lua @ 13028:b2e6a175537d

mod_debug_reset: Don't delay operations until next tick For some unknown reason, this was required with the old mock util.time functions prior to 012d6e7b723a. After 012d6e7b723a, it breaks. So I'm happy to revert to not delaying anything. This makes tests pass again.
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Apr 2023 14:17:50 +0100
parent 12977:74b9e05af71e
child 13029:8ad432953300
comparison
equal deleted inserted replaced
13027:012d6e7b723a 13028:b2e6a175537d
16 table.insert(hosts, host); 16 table.insert(hosts, host);
17 end 17 end
18 module:fire_event("server-resetting"); 18 module:fire_event("server-resetting");
19 for _, host in ipairs(hosts) do 19 for _, host in ipairs(hosts) do
20 hostmanager.deactivate(host); 20 hostmanager.deactivate(host);
21 timer.add_task(0, function () 21 hostmanager.activate(host);
22 hostmanager.activate(host); 22 module:log("info", "Reset complete");
23 module:log("info", "Reset complete"); 23 module:fire_event("server-reset");
24 module:fire_event("server-reset");
25 end);
26 end 24 end
27 end 25 end
28 26
29 function module.add_host(host_module) 27 function module.add_host(host_module)
30 host_module:hook("resource-unbind", function () 28 host_module:hook("resource-unbind", function ()
31 if next(prosody.full_sessions) == nil then 29 if next(prosody.full_sessions) == nil then
32 timer.add_task(0, do_reset); 30 do_reset();
33 end 31 end
34 end); 32 end);
35 end 33 end
36 34
37 local console_env = module:shared("/*/admin_shell/env"); 35 local console_env = module:shared("/*/admin_shell/env");