Software /
code /
prosody-modules
Diff
mod_measure_memory/mod_measure_memory.lua @ 1655:4d38b8c03dfe
mod_measure_memory: Silence warnings [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Apr 2015 22:05:48 +0200 |
parent | 1623:2c39af0fb93b |
child | 2436:a01a3fb96302 |
line wrap: on
line diff
--- a/mod_measure_memory/mod_measure_memory.lua Tue Apr 07 18:12:40 2015 +0200 +++ b/mod_measure_memory/mod_measure_memory.lua Tue Apr 07 22:05:48 2015 +0200 @@ -5,8 +5,8 @@ local measures = {}; setmetatable(measures, { - __index = function (t, k, m) - m = measure("sizes", "memory."..k); t[k] = m; return m; + __index = function (t, k) + local m = measure("sizes", "memory."..k); t[k] = m; return m; end }); @@ -23,9 +23,7 @@ end); end -local statm = io.open("/proc/self/statm"); -if statm then - statm:close(); +if require"lfs".attributes("/proc/self/statm", "mode") == "file" then local pagesize = module:get_option_number("memory_pagesize", 4096); -- getconf PAGESIZE module:hook("stats-update", function ()