Mercurial > prosody-modules
comparison mod_auto_activate_hosts/mod_auto_activate_hosts.lua @ 1013:8285c3502100
mod_auto_activate_hosts: Don't activate * when the config is reloaded
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 18 May 2013 11:46:11 +0100 |
| parents | 9c88960b0f81 |
| children | 7dbde05b48a9 |
comparison
equal
deleted
inserted
replaced
| 1012:c53a1b8a1cfa | 1013:8285c3502100 |
|---|---|
| 14 end | 14 end |
| 15 | 15 |
| 16 function handle_reload() | 16 function handle_reload() |
| 17 local new_config = config.getconfig(); | 17 local new_config = config.getconfig(); |
| 18 local active_hosts = set.new(array.collect(it.keys(prosody.hosts)):filter(host_not_global)); | 18 local active_hosts = set.new(array.collect(it.keys(prosody.hosts)):filter(host_not_global)); |
| 19 local enabled_hosts = set.new(array.collect(it.keys(new_config)):filter(host_is_enabled)); | 19 local enabled_hosts = set.new(array.collect(it.keys(new_config)):filter(host_is_enabled):filter(host_not_global)); |
| 20 local need_to_activate = enabled_hosts - active_hosts; | 20 local need_to_activate = enabled_hosts - active_hosts; |
| 21 local need_to_deactivate = active_hosts - enabled_hosts; | 21 local need_to_deactivate = active_hosts - enabled_hosts; |
| 22 | 22 |
| 23 module:log("debug", "Config reloaded... %d hosts need activating, and %d hosts need deactivating", it.count(need_to_activate), it.count(need_to_deactivate)); | 23 module:log("debug", "Config reloaded... %d hosts need activating, and %d hosts need deactivating", it.count(need_to_activate), it.count(need_to_deactivate)); |
| 24 module:log("debug", "There are %d enabled and %d active hosts", it.count(enabled_hosts), it.count(active_hosts)); | 24 module:log("debug", "There are %d enabled and %d active hosts", it.count(enabled_hosts), it.count(active_hosts)); |
