Skip to content

Commit a95bb59

Browse files
Use a more limited number of threads when fetching in parallel
The currently hardcoded 25 is too much and seems to cause some systems to even run out of memory. This also removes the only rubinius specific code in the repository. We don't really support rubinius so it doesn't make sense to keep those different branches.
1 parent 56fd9e1 commit a95bb59

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
@@ -116,7 +116,7 @@ def serial_compact_index_client
116116
def bundle_worker(func = nil)
117117
@bundle_worker ||= begin
118118
worker_name = "Compact Index (#{display_uri.host})"
119-
Bundler::Worker.new(Bundler.current_ruby.rbx? ? 1 : 25, worker_name, func)
119+
Bundler::Worker.new(Bundler.settings.processor_count, worker_name, func)
120120
end
121121
@bundle_worker.tap do |worker|
122122
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
@@ -209,6 +209,13 @@ def pretty_values_for(exposed_key)
209209
locations
210210
end
211211

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

0 commit comments

Comments
 (0)