Skip to content

Commit a025403

Browse files
Merge pull request #4670 from rubygems/25_threads_is_too_much
Use a more limited number of threads when fetching in parallel from the Compact Index API (cherry picked from commit 54adf80)
1 parent 11726a6 commit a025403

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

bundler/lib/bundler/fetcher/compact_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def serial_compact_index_client
111111
def bundle_worker(func = nil)
112112
@bundle_worker ||= begin
113113
worker_name = "Compact Index (#{display_uri.host})"
114-
Bundler::Worker.new(Bundler.current_ruby.rbx? ? 1 : 25, worker_name, func)
114+
Bundler::Worker.new(Bundler.settings.processor_count, worker_name, func)
115115
end
116116
@bundle_worker.tap do |worker|
117117
worker.instance_variable_set(:@func, func) if func

bundler/lib/bundler/installer.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,7 @@ def installation_parallelization(options)
222222
# Parallelization has some issues on Windows, so it's not yet the default
223223
return 1 if Gem.win_platform?
224224

225-
processor_count
226-
end
227-
228-
def processor_count
229-
require "etc"
230-
Etc.nprocessors
231-
rescue StandardError
232-
1
225+
Bundler.settings.processor_count
233226
end
234227

235228
def load_plugins

bundler/lib/bundler/settings.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ def pretty_values_for(exposed_key)
210210
locations
211211
end
212212

213+
def processor_count
214+
require "etc"
215+
Etc.nprocessors
216+
rescue StandardError
217+
1
218+
end
219+
213220
# for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
214221
def path
215222
configs.each do |_level, settings|

0 commit comments

Comments
 (0)