pull: do fetch after everything else, sleep more.
Use an exponential back-off on the sleep and try the fetch more times. Hopefully this will mean that we spent less time waiting for Bintray. Closes Homebrew/homebrew#43240. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
4e5d92dc10
commit
166e33c2ff
@ -57,6 +57,8 @@ module Homebrew
|
|||||||
odie "You meant `git pull --rebase`."
|
odie "You meant `git pull --rebase`."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bintray_fetch_formulae =[]
|
||||||
|
|
||||||
ARGV.named.each do |arg|
|
ARGV.named.each do |arg|
|
||||||
if arg.to_i > 0
|
if arg.to_i > 0
|
||||||
url = "https://github.com/Homebrew/homebrew/pull/#{arg}"
|
url = "https://github.com/Homebrew/homebrew/pull/#{arg}"
|
||||||
@ -189,19 +191,29 @@ module Homebrew
|
|||||||
"-u#{bintray_user}:#{bintray_key}", "-X", "POST",
|
"-u#{bintray_user}:#{bintray_key}", "-X", "POST",
|
||||||
"-d", '{"publish_wait_for_secs": -1}',
|
"-d", '{"publish_wait_for_secs": -1}',
|
||||||
"https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
|
"https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
|
||||||
sleep 5
|
bintray_fetch_formulae << f
|
||||||
success = system "brew", "fetch", "--retry", "--force-bottle", f.full_name
|
|
||||||
unless success
|
|
||||||
ohai "That didn't work; sleeping another 10 and trying again..."
|
|
||||||
sleep 10
|
|
||||||
system "brew", "fetch", "--retry", "--force-bottle", f.full_name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
opoo "You must set BINTRAY_USER and BINTRAY_KEY to add or update bottles on Bintray!"
|
opoo "You must set BINTRAY_USER and BINTRAY_KEY to add or update bottles on Bintray!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bintray_fetch_formulae.each do |f|
|
||||||
|
max_retries = 5
|
||||||
|
retry_count = 0
|
||||||
|
begin
|
||||||
|
success = system "brew", "fetch", "--force-bottle", f.full_name
|
||||||
|
raise "Failed to download #{f} bottle!" unless success
|
||||||
|
rescue RuntimeError => e
|
||||||
|
retry_count += 1
|
||||||
|
raise e if retry_count >= max_retries
|
||||||
|
sleep_seconds = 2**retry_count
|
||||||
|
ohai "That didn't work; sleeping #{sleep_seconds} seconds and trying again..."
|
||||||
|
sleep sleep_seconds
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ohai "Patch changed:"
|
ohai "Patch changed:"
|
||||||
safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD"
|
safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user