Software /
code /
prosody-modules
Diff
mod_statistics/stats.lib.lua @ 2300:dded110af017
mod_statistics/stats: Guard usage of module:get_option() so we only call it when Prosody is running
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 18 Sep 2016 18:53:09 +0100 |
parent | 2209:2733cb8c82a9 |
child | 3217:063abaab666f |
line wrap: on
line diff
--- a/mod_statistics/stats.lib.lua Sat Sep 17 18:04:46 2016 +0200 +++ b/mod_statistics/stats.lib.lua Sun Sep 18 18:53:09 2016 +0100 @@ -32,8 +32,6 @@ c2s_sessions, s2s_sessions = module:shared("/*/c2s/sessions", "/*/s2s/sessions"); end -local memory_update_interval = module:get_option_number("statistics_meminfo_interval", 60); - local stats = { total_users = { get = function () return it.count(it.keys(bare_sessions)); end @@ -91,6 +89,12 @@ }; }; +local memory_update_interval = 60; +if prosody and prosody.arg then + memory_update_interval = module:get_option_number("statistics_meminfo_interval", 60); +end + + if has_pposix and pposix.meminfo then local cached_meminfo, last_cache_update;