Skip to content

Commit 796757a

Browse files
larskanismatzbot
authored andcommitted
[rubygems/rubygems] Remove override of worker jobs for bundle install --local
There seems to be no reason why the install should be serial for --local. The packages are still installed in the right dependency order in this case, so that parallel install can be used. This patch disables parallel install only in case of no_install_needed. Also remove the `option` argument, which is effectifely not used. ruby/rubygems@5da934ddb6
1 parent 42b0d46 commit 796757a

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

lib/bundler/cli/pristine.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run
4949
true
5050
end.map(&:name)
5151

52-
jobs = installer.send(:installation_parallelization, {})
52+
jobs = installer.send(:installation_parallelization)
5353
pristine_count = definition.specs.count - installed_specs.count
5454
# allow a pristining a single gem to skip the parallel worker
5555
jobs = [jobs, pristine_count].min

lib/bundler/definition.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@ def nothing_changed?
503503
!@locked_spec_with_invalid_deps
504504
end
505505

506+
def no_install_needed?
507+
no_resolve_needed? && !missing_specs?
508+
end
509+
506510
def no_resolve_needed?
507511
!unlocking? && nothing_changed?
508512
end

lib/bundler/installer.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ def run(options)
8080
if resolve_if_needed(options)
8181
ensure_specs_are_compatible!
8282
Bundler.load_plugins(@definition)
83-
options.delete(:jobs)
84-
else
85-
options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
8683
end
8784
install(options)
8885

@@ -197,18 +194,14 @@ def install(options)
197194
standalone = options[:standalone]
198195
force = options[:force]
199196
local = options[:local]
200-
jobs = installation_parallelization(options)
197+
jobs = installation_parallelization
201198
spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
202199
spec_installations.each do |installation|
203200
post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
204201
end
205202
end
206203

207-
def installation_parallelization(options)
208-
if jobs = options.delete(:jobs)
209-
return jobs
210-
end
211-
204+
def installation_parallelization
212205
if jobs = Bundler.settings[:jobs]
213206
return jobs
214207
end
@@ -233,7 +226,8 @@ def ensure_specs_are_compatible!
233226
def resolve_if_needed(options)
234227
@definition.prefer_local! if options[:"prefer-local"]
235228

236-
if options[:local] || (@definition.no_resolve_needed? && !@definition.missing_specs?)
229+
if options[:local] || @definition.no_install_needed?
230+
Bundler.settings.set_command_option(:jobs, 1) if @definition.no_install_needed? # to avoid the overhead of Bundler::Worker
237231
@definition.resolve_with_cache!
238232
false
239233
else

0 commit comments

Comments
 (0)