From 7380b7e774c58d311e87a7976a177790f5f730bb Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 7 Sep 2019 01:30:38 +1000 Subject: Save and load the mirror list between threads. --- mirror-checker.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mirror-checker.lua') diff --git a/mirror-checker.lua b/mirror-checker.lua index 0e8567e..e2975fe 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -130,6 +130,8 @@ local E = function(s) log(0, "ERROR ", s) end local C = function(s) log(-1, "CRITICAL", s) end local testing = function(t) +local mirrors = {} + for i, v in pairs(options.tests.value) do if t == v then return true end end @@ -372,6 +374,11 @@ local getMirrors = function () mirrors[host] = m end end + local file, e = io.open("results/mirrors.lua", "w+") + if nil == file then C("opening mirrors file - " .. e) else + file:write(dumpTable(mirrors, "", "mirrors") .. "\nreturn mirrors\n") + file:close() + end return mirrors end @@ -463,6 +470,8 @@ if 0 < #arg then end if nil == logFile then C("opening log file - " .. e); return end I("Starting tests for " ..arg[1] .. " with these tests - " .. table.concat(options.tests.value, ", ")) + mirrors = loadfile("results/mirrors.lua")() +--print(dumpTable(mirrors, "", "mirrors")) if nil ~= arg[2] then I(" Using IP " .. arg[2]) end if nil ~= arg[3] then I(" Using file " .. arg[3]); end if testing("Integrity") or testing("Updated") then @@ -487,7 +496,8 @@ else if nil == logFile then C("opening log file - " .. e); return end I("Starting tests " .. table.concat(options.tests.value, ", ")) execute("mkdir -p results") - local mirrors = getMirrors() + mirrors = getMirrors() +--print(dumpTable(mirrors, "", "mirrors")) mirrors[options.referenceSite.value] = nil checkRedirects(options.referenceSite.value) -- forkIP(options.referenceSite.value) -- cgit v1.1