aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-update-data.lua
diff options
context:
space:
mode:
authoronefang2019-12-27 13:53:50 +1000
committeronefang2019-12-27 13:53:50 +1000
commit73808f2d16a80c350ba420a5d88823e0be509b1b (patch)
tree783e36eac4fbaf9ef2be36a68ae2b6efa64695bf /apt-panopticon-update-data.lua
parentOptimise updater a tiny bit. (diff)
downloadapt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.zip
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.gz
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.bz2
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.xz
Add timeouts tracking.
Diffstat (limited to 'apt-panopticon-update-data.lua')
-rwxr-xr-xapt-panopticon-update-data.lua34
1 files changed, 33 insertions, 1 deletions
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua
index 57eddd9..ceef7f3 100755
--- a/apt-panopticon-update-data.lua
+++ b/apt-panopticon-update-data.lua
@@ -11,6 +11,35 @@ local arg, sendArgs = APT.parseArgs({...})
11 11
12local oldest = 0 12local oldest = 0
13 13
14local fixResults = function(f)
15 if APT.checkFile(f) then
16 local results = loadfile(f)()
17 results = APT.padResults(results)
18 for i, w in pairs(APT.protocols) do
19 tests = results[w]
20 if nil ~= tests.Redirects then
21 tests.redirects = tests.Redirects
22 tests.Redirects = nil
23 elseif nil == tests.redirects then
24 tests.redirects = {}
25 end
26 results[w] = tests
27 end
28 if nil ~= results.Redirects then
29 for i, w in pairs(APT.protocols) do
30 results[w].redirects = results.Redirects
31 end
32 results.Redirects = nil
33 end
34 local rfile, e = io.open(f, "w+")
35 if nil == rfile then C("opening results file - " .. e) else
36 rfile:write(APT.dumpTable(results, "", "results") .. "\nreturn results\n")
37 rfile:close()
38 end
39 end
40end
41
42
14local lock = 'apt-panopticon.lock' 43local lock = 'apt-panopticon.lock'
15while APT.checkFile(lock) do os.execute('sleep 10') end 44while APT.checkFile(lock) do os.execute('sleep 10') end
16os.execute('touch ' .. lock) 45os.execute('touch ' .. lock)
@@ -53,7 +82,6 @@ for l in files:lines() do
53 local f = l:sub(1, -8) .. "/" .. k .. ".lua" 82 local f = l:sub(1, -8) .. "/" .. k .. ".lua"
54 if APT.checkFile(f) then 83 if APT.checkFile(f) then
55 results = loadfile(f)() 84 results = loadfile(f)()
56 results = APT.padResults(results)
57 results['IPs'] = v.IPs 85 results['IPs'] = v.IPs
58 local rfile, e = io.open(f, "w+") 86 local rfile, e = io.open(f, "w+")
59 if nil == rfile then C("opening results file - " .. e) else 87 if nil == rfile then C("opening results file - " .. e) else
@@ -63,6 +91,10 @@ for l in files:lines() do
63 end 91 end
64 end 92 end
65 end 93 end
94 local fls = io.popen('ls -1 ' .. lsub .. '/*.lua 2>/dev/null')
95 for k in fls:lines() do
96 fixResults(k)
97 end
66end 98end
67 99
68 100