diff options
author | onefang | 2019-12-03 06:25:01 +1000 |
---|---|---|
committer | onefang | 2019-12-03 06:25:01 +1000 |
commit | 196322a8b061cd671a1552e4115d7b46ac6cf3f6 (patch) | |
tree | 8cd48af69c15f3bdfa11e2b134cb193ef84ec13a | |
parent | Implement URLSanity test. (diff) | |
download | apt-panopticon-196322a8b061cd671a1552e4115d7b46ac6cf3f6.zip apt-panopticon-196322a8b061cd671a1552e4115d7b46ac6cf3f6.tar.gz apt-panopticon-196322a8b061cd671a1552e4115d7b46ac6cf3f6.tar.bz2 apt-panopticon-196322a8b061cd671a1552e4115d7b46ac6cf3f6.tar.xz |
Add max time for each download.
-rwxr-xr-x | apt-panopticon.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 21e7599..fd757ec 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -48,6 +48,12 @@ options = | |||
48 | "Updated", | 48 | "Updated", |
49 | }, | 49 | }, |
50 | }, | 50 | }, |
51 | maxtime = | ||
52 | { | ||
53 | typ = "number", | ||
54 | help = "", | ||
55 | value = 300, | ||
56 | }, | ||
51 | timeout = | 57 | timeout = |
52 | { | 58 | { |
53 | typ = "number", | 59 | typ = "number", |
@@ -679,6 +685,7 @@ local postDownload = function(host, r, k) | |||
679 | if options.referenceSite.value == host then | 685 | if options.referenceSite.value == host then |
680 | if "Packages." == file:sub(1, 9) then | 686 | if "Packages." == file:sub(1, 9) then |
681 | -- TODO - compare the SHA256 sums in pkgmaster's Release for both the packed and unpacked versions. | 687 | -- TODO - compare the SHA256 sums in pkgmaster's Release for both the packed and unpacked versions. |
688 | -- Also note that this might get only a partial download due to maxtime. | ||
682 | local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed', "w+") | 689 | local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed', "w+") |
683 | if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed' .. ' file - ' .. e) else | 690 | if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed' .. ' file - ' .. e) else |
684 | local pp = {} | 691 | local pp = {} |
@@ -734,7 +741,7 @@ local postDownload = function(host, r, k) | |||
734 | end | 741 | end |
735 | 742 | ||
736 | local downloadLock = "flock -n results/curl-" | 743 | local downloadLock = "flock -n results/curl-" |
737 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L -z 'results/stamp.old' -v -R " | 744 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L --max-time " .. options.maxtime.value .. " -z 'results/stamp.old' -v -R " |
738 | local downloads = function(host, URL, release, list) | 745 | local downloads = function(host, URL, release, list) |
739 | if nil == URL then URL = "" end | 746 | if nil == URL then URL = "" end |
740 | local lock = "%s-" .. host .. ".lock" | 747 | local lock = "%s-" .. host .. ".lock" |