Changeset

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
parents 2299:e099586f9de5
children 2301:d7c014f91189
files mod_statistics/stats.lib.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
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;