Merge pull request #13812 from carlocab/fetch-tries
cmd/fetch: rename `fetch_failed` to `fetch_tries`.
This commit is contained in:
commit
db921d88d9
@ -162,17 +162,17 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def retry_fetch?(f, args:)
|
def retry_fetch?(f, args:)
|
||||||
@fetch_failed ||= Hash.new { |h, k| h[k] = 1 }
|
@fetch_tries ||= Hash.new { |h, k| h[k] = 1 }
|
||||||
if args.retry? && (@fetch_failed[f] < FETCH_MAX_TRIES)
|
if args.retry? && (@fetch_tries[f] < FETCH_MAX_TRIES)
|
||||||
wait = 2 ** @fetch_failed[f]
|
wait = 2 ** @fetch_tries[f]
|
||||||
remaining = FETCH_MAX_TRIES - @fetch_failed[f]
|
remaining = FETCH_MAX_TRIES - @fetch_tries[f]
|
||||||
what = "try".pluralize(remaining)
|
what = "try".pluralize(remaining)
|
||||||
|
|
||||||
ohai "Retrying download in #{wait}s... (#{remaining} #{what} left)"
|
ohai "Retrying download in #{wait}s... (#{remaining} #{what} left)"
|
||||||
sleep wait
|
sleep wait
|
||||||
|
|
||||||
f.clear_cache
|
f.clear_cache
|
||||||
@fetch_failed[f] += 1
|
@fetch_tries[f] += 1
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user