comparison plugins/mod_cron.lua @ 13588:899453f11f50

mod_cron: Don't run tasks if loaded inside prosodyctl It's common for modules to depend on mod_cron, and this can lead to it loading inside prosodyctl, where we don't really want to run any cron tasks.
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Jan 2025 18:06:29 +0000
parents 98a6ec4ce140
children 1aa7efabeacb
comparison
equal deleted inserted replaced
13587:fdb2e0568cf8 13588:899453f11f50
5 local cron_initial_delay = module:get_option_number("cron_initial_delay", 1); 5 local cron_initial_delay = module:get_option_number("cron_initial_delay", 1);
6 local cron_check_delay = module:get_option_number("cron_check_delay", 3600); 6 local cron_check_delay = module:get_option_number("cron_check_delay", 3600);
7 local cron_spread_factor = module:get_option_number("cron_spread_factor", 0); 7 local cron_spread_factor = module:get_option_number("cron_spread_factor", 0);
8 8
9 local active_hosts = {} 9 local active_hosts = {}
10
11 if prosody.process_type == "prosodyctl" then
12 return; -- Yes, it happens...
13 end
10 14
11 function module.add_host(host_module) 15 function module.add_host(host_module)
12 16
13 local last_run_times = host_module:open_store("cron", "map"); 17 local last_run_times = host_module:open_store("cron", "map");
14 active_hosts[host_module.host] = true; 18 active_hosts[host_module.host] = true;