fetchurl: Don't wait too long for the hashed mirrors
If the hashed mirror (nixos.org/tarballs) doesn't respond in 15 seconds, give up and try the original URL.
This commit is contained in:
parent
f337ab4430
commit
04765da09a
|
@ -41,7 +41,8 @@ tryHashedMirrors() {
|
|||
|
||||
for mirror in $hashedMirrors; do
|
||||
url="$mirror/$outputHashAlgo/$outputHash"
|
||||
if $curl --fail --silent --show-error --head "$url" \
|
||||
if $curl --retry 0 --connect-timeout "${NIX_CONNECT_TIMEOUT:-15}" \
|
||||
--fail --silent --show-error --head "$url" \
|
||||
--write-out "%{http_code}" --output /dev/null > code 2> log; then
|
||||
tryDownload "$url"
|
||||
if test -n "$success"; then finish; fi
|
||||
|
|
|
@ -32,6 +32,10 @@ let
|
|||
# This variable allows the user to override hashedMirrors from the
|
||||
# command-line.
|
||||
"NIX_HASHED_MIRRORS"
|
||||
|
||||
# This variable allows overriding the timeout for connecting to
|
||||
# the hashed mirrors.
|
||||
"NIX_CONNECT_TIMEOUT"
|
||||
] ++ (map (site: "NIX_MIRRORS_${site}") sites);
|
||||
|
||||
in
|
||||
|
|
Loading…
Reference in New Issue