mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add retries to some online audit checks
This commit is contained in:
parent
fbe50bf280
commit
e80bb70bed
@ -149,7 +149,13 @@ module Homebrew
|
|||||||
problem http_content_problem
|
problem http_content_problem
|
||||||
end
|
end
|
||||||
elsif strategy <= GitDownloadStrategy
|
elsif strategy <= GitDownloadStrategy
|
||||||
problem "The URL #{url} is not a valid git URL" unless Utils::Git.remote_exists? url
|
attempts = 0
|
||||||
|
remote_exists = T.let(false, T::Boolean)
|
||||||
|
while !remote_exists && attempts < Homebrew::EnvConfig.curl_retries.to_i
|
||||||
|
remote_exists = Utils::Git.remote_exists?(url)
|
||||||
|
attempts += 1
|
||||||
|
end
|
||||||
|
problem "The URL #{url} is not a valid git URL" unless remote_exists
|
||||||
elsif strategy <= SubversionDownloadStrategy
|
elsif strategy <= SubversionDownloadStrategy
|
||||||
next unless DevelopmentTools.subversion_handles_most_https_certificates?
|
next unless DevelopmentTools.subversion_handles_most_https_certificates?
|
||||||
next unless Utils::Svn.available?
|
next unless Utils::Svn.available?
|
||||||
|
@ -298,9 +298,10 @@ module Utils
|
|||||||
end
|
end
|
||||||
|
|
||||||
details = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))
|
details = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))
|
||||||
|
attempts = 0
|
||||||
user_agents.each do |user_agent|
|
user_agents.each do |user_agent|
|
||||||
details =
|
loop do
|
||||||
curl_http_content_headers_and_checksum(
|
details = curl_http_content_headers_and_checksum(
|
||||||
url,
|
url,
|
||||||
specs: specs,
|
specs: specs,
|
||||||
hash_needed: hash_needed,
|
hash_needed: hash_needed,
|
||||||
@ -308,6 +309,14 @@ module Utils
|
|||||||
user_agent: user_agent,
|
user_agent: user_agent,
|
||||||
referer: referer,
|
referer: referer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Retry on network issues
|
||||||
|
break if details[:exit_status] != 52 && details[:exit_status] != 56
|
||||||
|
|
||||||
|
attempts += 1
|
||||||
|
break if attempts >= Homebrew::EnvConfig.curl_retries.to_i
|
||||||
|
end
|
||||||
|
|
||||||
break if http_status_ok?(details[:status_code])
|
break if http_status_ok?(details[:status_code])
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -453,6 +462,7 @@ module Utils
|
|||||||
{
|
{
|
||||||
url: url,
|
url: url,
|
||||||
final_url: final_url,
|
final_url: final_url,
|
||||||
|
exit_status: status.exitstatus,
|
||||||
status_code: status_code,
|
status_code: status_code,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
etag: etag,
|
etag: etag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user