Add POST timeout to prevent housekeeping from blocking indefinitely

This commit is contained in:
emanuele-f 2018-07-30 12:48:41 +02:00
parent 828ee884ff
commit 44abcd442c
5 changed files with 22 additions and 6 deletions

View file

@ -220,7 +220,7 @@ end
-- ########################################################
function callback_utils.uploadTSdata()
local url = ntop.getCache("ntopng.prefs.ts_post_data_url")
local url = ntop.getPref("ntopng.prefs.ts_post_data_url")
if((url == nil) or (url == "")) then
return
@ -243,7 +243,7 @@ function callback_utils.uploadTSdata()
-- Delete the file after POST
local delete_file_after_post = true
ret = ntop.postHTTPTextFile("", "", url .. "/write?db=ntopng", fname, delete_file_after_post)
ret = ntop.postHTTPTextFile("", "", url .. "/write?db=ntopng", fname, delete_file_after_post, 5 --[[ timeout ]])
--print(fname .. "\n")
if(ret ~= true) then
@ -251,6 +251,7 @@ function callback_utils.uploadTSdata()
-- delete the file manually
os.remove(fname)
break
end
end