Mercurial > prosody-modules
comparison mod_reload_modules/mod_reload_modules.lua @ 3882:3b8f4f3b1718
mod_reload_modules: Ignore removed hosts...
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Wed, 05 Feb 2020 23:27:33 +0100 |
parents | 57eb248f6dd3 |
children | cc14bfec209b |
comparison
equal
deleted
inserted
replaced
3881:5d7df207dc2b | 3882:3b8f4f3b1718 |
---|---|
6 if not modules then | 6 if not modules then |
7 module:log("warn", "No modules listed in the config to reload - set reload_modules to a list"); | 7 module:log("warn", "No modules listed in the config to reload - set reload_modules to a list"); |
8 return; | 8 return; |
9 end | 9 end |
10 local configured_modules = module:get_option_inherited_set("modules_enabled", {}); | 10 local configured_modules = module:get_option_inherited_set("modules_enabled", {}); |
11 -- ignore removed hosts | |
12 if not prosody.hosts[module.host] then | |
13 module:log("warn", "Ignoring host %s: host was removed...", module.host); | |
14 return; | |
15 end | |
11 local loaded_modules = set.new(array.collect(it.keys(prosody.hosts[module.host].modules))); | 16 local loaded_modules = set.new(array.collect(it.keys(prosody.hosts[module.host].modules))); |
12 local need_to_load = set.intersection(configured_modules - loaded_modules, modules); | 17 local need_to_load = set.intersection(configured_modules - loaded_modules, modules); |
13 local need_to_unload = set.intersection(loaded_modules - configured_modules, modules); | 18 local need_to_unload = set.intersection(loaded_modules - configured_modules, modules); |
14 | 19 |
15 for module_name in need_to_load do | 20 for module_name in need_to_load do |