From 5e8b0adf2a39debac8354fd98ca7d5b729580ff7 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 23 Dec 2019 13:01:05 +1000 Subject: Major refactor, especially of the downloading and processing code. Make the code more readable, less scattered. Use a coroutine to multitask better. Plugable functions for parsing the download results, and figuring out what to download next. Track timeouts at a finer level. Dig for IPs in the forked apt-panopticons, not all at once at the beginning. Various cleanups and tweaks. --- apt-panopticon-report-email-web.lua | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'apt-panopticon-report-email-web.lua') diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 8a5404a..c52b6c0 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -3,6 +3,7 @@ local APT = require 'apt-panopticommon' local D = APT.D local I = APT.I +local T = APT.T local W = APT.W local E = APT.E local C = APT.C @@ -47,16 +48,19 @@ local status = function(host, results, typ) local result = "" local e = 0 local w = 0 + local t = 0 local s = nil ~= APT.mirrors[host].Protocols[typ] local to = results.timeout if not APT.search(APT.protocols, typ) then s = true end if nil ~= results[typ] then e = results[typ].errors w = results[typ].warnings + t = results[typ].timeouts for k, v in pairs(results[typ]) do if "table" == type(v) then if 0 <= v.errors then e = e + v.errors else to = true end if 0 <= v.warnings then w = w + v.warnings else to = true end + if 0 <= v.timeouts then t = t + v.timeouts else to = true end end end else @@ -67,6 +71,7 @@ local status = function(host, results, typ) if typ == i then if 0 <= u.errors then e = e + u.errors end if 0 <= u.warnings then w = w + u.warnings end + if 0 <= u.timeouts then t = t + u.timeouts end end end end @@ -99,6 +104,21 @@ local status = function(host, results, typ) else faulty = faulty .. host .. " (" .. typ .. ")\n" end + elseif 0 < t then + result = "[timeout" + if not s then result = result .. "*" end + if APT.html then + if s then + result = "[timeout" + else + result = "[timeout*" + end + end + if APT.html then + faulty = faulty .. host .. " (" .. typ .. ")
\n" + else + faulty = faulty .. host .. " (" .. typ .. ")\n" + end else result = "[OK" if not s then result = result .. "*" end @@ -110,7 +130,7 @@ local status = function(host, results, typ) end end end - return result .. APT.plurals(e, w) .. "]" + return result .. APT.plurals(e, w, t) .. "]" end local m = {} @@ -125,9 +145,11 @@ local logCount = function(domain, ip) if nil ~= rfile then local errors = 0 local warnings = 0 + local timeouts = 0 for l in rfile:lines() do if nil ~= l:match(">ERROR ") then errors = errors + 1 end if nil ~= l:match(">WARNING ") then warnings = warnings + 1 end + if nil ~= l:match(">TIMEOUT ") then timeouts = timeouts + 1 end end rfile:close() if APT.html then @@ -137,7 +159,7 @@ local logCount = function(domain, ip) log = "" .. ip .. "" end end - log = log .. APT.plurals(errors, warnings) + log = log .. APT.plurals(errors, warnings, timeouts) end return log end @@ -303,8 +325,11 @@ if nil == web then C("opening mirrors file - " .. e) else " means the tested thing is supported for that mirror.

\n" .. "

[FAILED*] or [OK*]" .. " means the tested thing is unsupported for that mirror, but might have been tested anyway.

\n" .. + "

[timeout] or [timeout]" .. + " means the mirror had some timeouts, and tests where not yet aborted. The darker colour means unsupported by the mirror, but tested anyway.

" .. "

[TIMEOUT] or [TIMEOUT]" .. - " means the server had too many timeouts, and tests where aborted, so there is no result for this test.

" .. + " means the mirror had too many timeouts, and tests where aborted, so there is no result for this test.

" .. + "

NOTE: timeouts may be due to a problem on the testing computer.

" .. "

The DNS round robin (DNS-RR) column shows the IPs for that mirror, or [no] if it isn't part of the DNS-RR.   " .. "The IPs link to the testing log for that IP accessed via the DNS-RR.   " .. "deb.devuan.org is the DNS-RR itself, so it doesn't get tested directly.

\n" .. -- cgit v1.1