comparison plugins/mod_debug_reset.lua @ 14114:8f50e7e43df4 13.0

mod_debug_reset: Trigger GC cycles to aid with cleanup This was observed to be necessary, as we use weak tables in a couple of places and data could persist across resets unless the GC runs.
author Matthew Wild <mwild1@gmail.com>
date Fri, 27 Mar 2026 12:45:38 +0000
parents 8ad432953300
children 368df9b2d511
comparison
equal deleted inserted replaced
14113:b9688ac25255 14114:8f50e7e43df4
14 table.insert(hosts, host); 14 table.insert(hosts, host);
15 end 15 end
16 module:fire_event("server-resetting"); 16 module:fire_event("server-resetting");
17 for _, host in ipairs(hosts) do 17 for _, host in ipairs(hosts) do
18 hostmanager.deactivate(host); 18 hostmanager.deactivate(host);
19 for i = 1, 4 do
20 -- Run a few cycles to ensure full cleanup, including
21 -- weak tables and finalizers
22 collectgarbage("collect");
23 end
19 hostmanager.activate(host); 24 hostmanager.activate(host);
20 module:log("info", "Reset complete"); 25 module:log("info", "Reset complete");
21 module:fire_event("server-reset"); 26 module:fire_event("server-reset");
22 end 27 end
23 end 28 end