cmd/fetch: rename fetch_failed to fetch_tries.
This makes the code substantially easier to understand. Follow-up to #13807.
This commit is contained in:
parent
ccc235171f
commit
708935d2c8
@ -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