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
5555 end
5656
5757 sig {
58- params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) )
58+ params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) , stale_seconds : Integer )
5959 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
6060 }
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 :
6363 end
6464
6565 sig {
66- params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) )
66+ params ( download_queue : T . nilable ( ::Homebrew ::DownloadQueue ) , stale_seconds : Integer )
6767 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
6868 }
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 )
7170 Homebrew ::API . fetch_json_api_file "cask_tap_migrations.jws.json" , stale_seconds :, download_queue :
7271 end
7372
Original file line number Diff line number Diff line change @@ -55,19 +55,18 @@ def self.cached_json_file_path
5555 end
5656
5757 sig {
58- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) )
58+ params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : Integer )
5959 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
6060 }
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 :
6363 end
6464
6565 sig {
66- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) )
66+ params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : Integer )
6767 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
6868 }
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 )
7170 Homebrew ::API . fetch_json_api_file "formula_tap_migrations.jws.json" , stale_seconds :, download_queue :
7271 end
7372
Original file line number Diff line number Diff line change 8888 cmd_class = Homebrew ::AbstractCommand . command ( cmd )
8989 Homebrew . running_command = cmd
9090 if cmd_class
91- if Homebrew ::EnvConfig . download_concurrency > 1
91+ if ! Homebrew :: EnvConfig . no_install_from_api? && Homebrew ::EnvConfig . download_concurrency > 1
9292 require "download_queue"
9393 require "api"
9494 require "api/formula"
9595 require "api/cask"
9696 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 :)
101102 begin
102103 download_queue . fetch
103104 ensure
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ def run
184184
185185 sig { returns ( Integer ) }
186186 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 ) )
188188 end
189189
190190 sig { returns ( DownloadQueue ) }
Original file line number Diff line number Diff line change 99module Homebrew
1010 class DownloadQueue
1111 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 )
1313 @concurrency = T . let ( EnvConfig . download_concurrency , Integer )
1414 @quiet = T . let ( @concurrency > 1 , T ::Boolean )
1515 @tries = T . let ( retries + 1 , Integer )
You can’t perform that action at this time.
0 commit comments