mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Caches timeout information for an hour
This commit is contained in:
parent
fee595eabf
commit
7083d97523
1 changed files with 6 additions and 4 deletions
|
|
@ -3339,13 +3339,15 @@ function getFolderSize(path, timeout)
|
|||
local MAX_TIMEOUT = tonumber(timeout) or 15 -- default
|
||||
-- Check if timeout is present on the system to cap the execution time of the subsequent du,
|
||||
-- which may be very time consuming, especially when the number of files is high
|
||||
local has_timeout = ntop.getCache("ntopng.cache.has_gnu_timeout") == "true"
|
||||
local has_timeout = ntop.getCache("ntopng.cache.has_gnu_timeout")
|
||||
|
||||
-- Cache the timeout
|
||||
if not has_timeout then
|
||||
if isEmptyString(has_timeout) then
|
||||
-- Cache the timeout
|
||||
-- Check timeout existence with which. If no timeout is found, command will return nil
|
||||
has_timeout = (os_utils.execWithOutput("which timeout >/dev/null 2>&1") ~= nil)
|
||||
ntop.setCache("ntopng.cache.has_gnu_timeout", tostring(has_timeout))
|
||||
ntop.setCache("ntopng.cache.has_gnu_timeout", tostring(has_timeout), 3600)
|
||||
else
|
||||
has_timeout = has_timeout == "true"
|
||||
end
|
||||
|
||||
-- Check the cache for a recent value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue