aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-report-email-web.lua
diff options
context:
space:
mode:
authoronefang2019-12-04 08:14:16 +1000
committeronefang2019-12-04 08:14:16 +1000
commitdaca02cdef0abe2557b7a6a2abae82a159116157 (patch)
tree7420ddcf436331b051bb72ac813f0f8b7092eccb /apt-panopticon-report-email-web.lua
parentDon't log some of the executes. (diff)
downloadapt-panopticon-daca02cdef0abe2557b7a6a2abae82a159116157.zip
apt-panopticon-daca02cdef0abe2557b7a6a2abae82a159116157.tar.gz
apt-panopticon-daca02cdef0abe2557b7a6a2abae82a159116157.tar.bz2
apt-panopticon-daca02cdef0abe2557b7a6a2abae82a159116157.tar.xz
Move the speed calc to the main script.
Diffstat (limited to 'apt-panopticon-report-email-web.lua')
-rwxr-xr-xapt-panopticon-report-email-web.lua45
1 files changed, 17 insertions, 28 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index 03970ac..9e9d818 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -244,17 +244,22 @@ local collate = function(host, ip, results)
244 local rs = loadfile(f)() 244 local rs = loadfile(f)()
245 for k, v in pairs(rs) do 245 for k, v in pairs(rs) do
246 if "table" == type(v) then 246 if "table" == type(v) then
247 for i, u in pairs(v) do 247 if "speed" == k then
248 if "table" == type(u) then 248 if v.min < results.speed.min then results.speed.min = v.min end
249 for h, t in pairs(u) do 249 if v.max > results.speed.max then results.speed.max = v.max end
250 local a = results[k][h] 250 else
251 for i, u in pairs(v) do
252 if "table" == type(u) then
253 for h, t in pairs(u) do
254 local a = results[k][h]
255 if nil == a then a = 0 end
256 results[k][h] = a + t
257 end
258 else
259 local a = results[k][i]
251 if nil == a then a = 0 end 260 if nil == a then a = 0 end
252 results[k][h] = a + t 261 results[k][i] = a + u
253 end 262 end
254 else
255 local a = results[k][i]
256 if nil == a then a = 0 end
257 results[k][i] = a + u
258 end 263 end
259 end 264 end
260 else 265 else
@@ -445,7 +450,9 @@ if nil == web then C("opening mirrors file - " .. e) else
445 local updated = status(k, results, "Updated") 450 local updated = status(k, results, "Updated")
446 local rate = v.Rate 451 local rate = v.Rate
447 if nil ~= rate then updated = updated .. ' ' .. rate end 452 if nil ~= rate then updated = updated .. ' ' .. rate end
448 local min, max, spd = 999999999999, 0, '' 453 local min = tonumber(results.speed.min)
454 local max = tonumber(results.speed.max)
455 local spd = ''
449 456
450 -- DNS-RR test. 457 -- DNS-RR test.
451 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then 458 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then
@@ -476,25 +483,7 @@ if nil == web then C("opening mirrors file - " .. e) else
476 end 483 end
477 end 484 end
478 end 485 end
479 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end
480 486
481 for i, mt in pairs({'Release', 'Packages', 'META'}) do
482 if checkFile("results/curl-" .. mt .. "-" .. k .. ".log") then
483 for l in io.lines("results/curl-" .. mt .. "-" .. k .. ".log") do
484 local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)')
485 if nil ~= speed then
486 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end
487 if 'k' == crrnt:sub(-1, -1) then crrnt = crrnt:sub(1, -2) .. '000' end
488 speed = tonumber(speed)
489 crrnt = tonumber(crrnt)
490 if speed < min and speed ~= 0 then min = speed end
491 if speed > max then max = speed end
492 if crrnt < min and crrnt ~= 0 then min = crrnt end
493 if crrnt > max then max = crrnt end
494 end
495 end
496 end
497 end
498 if 0 == max then 487 if 0 == max then
499 spd = '<td></td><td></td>' 488 spd = '<td></td><td></td>'
500 else 489 else