api: don't add --time-cond on retries

This commit is contained in:
Bo Anderson 2023-02-09 18:26:37 +00:00
parent a26a2d71a8
commit 15c291f054
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -49,12 +49,13 @@ module Homebrew
default_url = "#{HOMEBREW_API_DEFAULT_DOMAIN}/#{endpoint}" default_url = "#{HOMEBREW_API_DEFAULT_DOMAIN}/#{endpoint}"
curl_args = %W[--compressed --speed-limit #{JSON_API_SPEED_MARGIN} --speed-time #{JSON_API_SPEED_TIME}] curl_args = %W[--compressed --speed-limit #{JSON_API_SPEED_MARGIN} --speed-time #{JSON_API_SPEED_TIME}]
curl_args.prepend("--silent") unless Context.current.debug? curl_args.prepend("--silent") unless Context.current.debug?
curl_args.prepend("--time-cond", target) if target.exist? && !target.empty?
begin begin
begin begin
args = curl_args.dup
args.prepend("--time-cond", target) if target.exist? && !target.empty?
# Disable retries here, we handle them ourselves below. # Disable retries here, we handle them ourselves below.
Utils::Curl.curl_download(*curl_args, url, to: target, retries: 0, show_error: false) Utils::Curl.curl_download(*args, url, to: target, retries: 0, show_error: false)
rescue ErrorDuringExecution rescue ErrorDuringExecution
if url == default_url if url == default_url
raise unless target.exist? raise unless target.exist?