Mercurial > prosody-modules
changeset 1655:4d38b8c03dfe
mod_measure_memory: Silence warnings [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Apr 2015 22:05:48 +0200 |
parents | 1a6d6221c5f6 |
children | 98a186874806 |
files | mod_measure_memory/mod_measure_memory.lua |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
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 ()