Caps du -s execution using a timeout to prevent long activities

This commit is contained in:
Simone Mainardi 2020-02-26 16:22:22 +01:00
parent 23f08f31ed
commit fee595eabf
5 changed files with 39 additions and 15 deletions

View file

@ -284,14 +284,15 @@ end
-- ########################################################
-- Read information about the disk space used by rrd (size is in bytes)
function rrd_utils.storageInfo(ifid)
--! @param timeout the maxium time to compute the size
function rrd_utils.storageInfo(ifid, timeout)
local dirs = ntop.getDirs()
local paths = getRRDPaths()
local info = { total = 0 }
for _, path in pairs(paths) do
local absolute_path = os_utils.fixPath(dirs.workingdir .. "/" .. ifid .. "/".. path .."/")
info[path] = getFolderSize(absolute_path)
info[path] = getFolderSize(absolute_path, timeout)
info["total"] = info["total"] + info[path]
end