File tree Expand file tree Collapse file tree 5 files changed +18
-19
lines changed Expand file tree Collapse file tree 5 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -55,19 +55,18 @@ def self.cached_json_file_path
55
55
end
56
56
57
57
sig {
58
- params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) )
58
+ params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) , stale_seconds : Integer )
59
59
. returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
60
60
}
61
- def self . fetch_api! ( download_queue : nil )
62
- Homebrew ::API . fetch_json_api_file api_filename , download_queue :
61
+ def self . fetch_api! ( download_queue : nil , stale_seconds : Homebrew :: EnvConfig . api_auto_update_secs . to_i )
62
+ Homebrew ::API . fetch_json_api_file api_filename , stale_seconds : , download_queue :
63
63
end
64
64
65
65
sig {
66
- params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) )
66
+ params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) , stale_seconds : Integer )
67
67
. returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
68
68
}
69
- def self . fetch_tap_migrations! ( download_queue : nil )
70
- stale_seconds = Homebrew ::API ::TAP_MIGRATIONS_STALE_SECONDS
69
+ def self . fetch_tap_migrations! ( download_queue : nil , stale_seconds : Homebrew ::API ::TAP_MIGRATIONS_STALE_SECONDS )
71
70
Homebrew ::API . fetch_json_api_file "cask_tap_migrations.jws.json" , stale_seconds :, download_queue :
72
71
end
73
72
Original file line number Diff line number Diff line change @@ -55,19 +55,18 @@ def self.cached_json_file_path
55
55
end
56
56
57
57
sig {
58
- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) )
58
+ params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : Integer )
59
59
. returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
60
60
}
61
- def self . fetch_api! ( download_queue : nil )
62
- Homebrew ::API . fetch_json_api_file api_filename , download_queue :
61
+ def self . fetch_api! ( download_queue : nil , stale_seconds : Homebrew :: EnvConfig . api_auto_update_secs . to_i )
62
+ Homebrew ::API . fetch_json_api_file api_filename , stale_seconds : , download_queue :
63
63
end
64
64
65
65
sig {
66
- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) )
66
+ params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : Integer )
67
67
. returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
68
68
}
69
- def self . fetch_tap_migrations! ( download_queue : nil )
70
- stale_seconds = Homebrew ::API ::TAP_MIGRATIONS_STALE_SECONDS
69
+ def self . fetch_tap_migrations! ( download_queue : nil , stale_seconds : Homebrew ::API ::TAP_MIGRATIONS_STALE_SECONDS )
71
70
Homebrew ::API . fetch_json_api_file "formula_tap_migrations.jws.json" , stale_seconds :, download_queue :
72
71
end
73
72
Original file line number Diff line number Diff line change 88
88
cmd_class = Homebrew ::AbstractCommand . command ( cmd )
89
89
Homebrew . running_command = cmd
90
90
if cmd_class
91
- if Homebrew ::EnvConfig . download_concurrency > 1
91
+ if ! Homebrew :: EnvConfig . no_install_from_api? && Homebrew ::EnvConfig . download_concurrency > 1
92
92
require "download_queue"
93
93
require "api"
94
94
require "api/formula"
95
95
require "api/cask"
96
96
download_queue = Homebrew ::DownloadQueue . new
97
- Homebrew ::API ::Formula . fetch_api! ( download_queue :)
98
- Homebrew ::API ::Formula . fetch_tap_migrations! ( download_queue :)
99
- Homebrew ::API ::Cask . fetch_api! ( download_queue :)
100
- Homebrew ::API ::Cask . fetch_tap_migrations! ( download_queue :)
97
+ stale_seconds = 86400 # 1 day
98
+ Homebrew ::API ::Formula . fetch_api! ( download_queue :, stale_seconds :)
99
+ Homebrew ::API ::Formula . fetch_tap_migrations! ( download_queue :, stale_seconds :)
100
+ Homebrew ::API ::Cask . fetch_api! ( download_queue :, stale_seconds :)
101
+ Homebrew ::API ::Cask . fetch_tap_migrations! ( download_queue :, stale_seconds :)
101
102
begin
102
103
download_queue . fetch
103
104
ensure
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ def run
184
184
185
185
sig { returns ( Integer ) }
186
186
def retries
187
- @retries ||= T . let ( args . retry? ? FETCH_MAX_TRIES : 0 , T . nilable ( Integer ) )
187
+ @retries ||= T . let ( args . retry? ? FETCH_MAX_TRIES : 1 , T . nilable ( Integer ) )
188
188
end
189
189
190
190
sig { returns ( DownloadQueue ) }
Original file line number Diff line number Diff line change 9
9
module Homebrew
10
10
class DownloadQueue
11
11
sig { params ( retries : Integer , force : T ::Boolean , pour : T ::Boolean ) . void }
12
- def initialize ( retries : 0 , force : false , pour : false )
12
+ def initialize ( retries : 1 , force : false , pour : false )
13
13
@concurrency = T . let ( EnvConfig . download_concurrency , Integer )
14
14
@quiet = T . let ( @concurrency > 1 , T ::Boolean )
15
15
@tries = T . let ( retries + 1 , Integer )
You can’t perform that action at this time.
0 commit comments