Fixes various lua memory issues

This commit is contained in:
Matteo Biscosi 2024-02-22 11:21:38 +00:00
parent eb52f62b1e
commit 5edfdeedcd
53 changed files with 336 additions and 551 deletions

View file

@ -101,6 +101,7 @@ function getProbeName(exporter_ip, show_vlan, shorten_len)
-- No alias set, let's try with the SNMP
if ntop.isPro() then
package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path
snmp_cached_dev = require "snmp_cached_dev"
end
@ -318,10 +319,6 @@ function getHostNotes(host_info)
return notes
end
function getDhcpNameKey(ifid, mac)
return string.format("ntopng.dhcp.%d.cache.%s", ifid, mac)
end
-- ##############################################
-- A function to give a useful device name
@ -910,7 +907,8 @@ end
-- Returns the size of a folder (size is in bytes)
-- ! @param path the path to compute the size for
-- ! @param timeout the maxium time to compute the size. If nil, it defaults to 15 seconds.
function getFolderSize(path, timeout, os_utils)
function getFolderSize(path, timeout)
local os_utils = require "os_utils"
local folder_size_key = "ntopng.cache.folder_size"
local now = os.time()
local expiration = 30 -- sec