diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 7c13c0c8a93..3212a682114 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -165,7 +165,7 @@ def install(options) load_plugins force = options["force"] jobs = 1 - jobs = [Bundler.settings[:jobs].to_i - 1, 1].max if can_install_in_parallel? + jobs = [Bundler.settings[:jobs].to_i, 1].max if can_install_in_parallel? install_in_parallel jobs, options[:standalone], force end diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index 97c124e0150..306a1bdc15b 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -79,7 +79,7 @@ def self.call(*args) # Returns max number of threads machine can handle with a min of 1 def self.max_threads - [Bundler.settings[:jobs].to_i - 1, 1].max + [Bundler.settings[:jobs].to_i, 1].max end attr_reader :size diff --git a/spec/realworld/parallel_spec.rb b/spec/realworld/parallel_spec.rb index b8233206e87..a3b29bf6081 100644 --- a/spec/realworld/parallel_spec.rb +++ b/spec/realworld/parallel_spec.rb @@ -9,10 +9,11 @@ gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+ G - bundle :install, :jobs => 4, :env => { "DEBUG" => "1" } + bundle :install, :jobs => 2, :env => { "DEBUG" => "1" } if Bundler.rubygems.provides?(">= 2.1.0") - expect(out).to match(/[1-3]: /) + expect(out).to match(/^0: /) + expect(out).to match(/^1: /) else expect(out).to include("is not threadsafe") end @@ -24,7 +25,7 @@ expect(out).to match(/faker/) bundle "config jobs" - expect(out).to match(/: "4"/) + expect(out).to match(/: "2"/) end it "updates" do @@ -41,10 +42,11 @@ gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+ G - bundle :update, :jobs => 4, :env => { "DEBUG" => "1" } + bundle :update, :jobs => 2, :env => { "DEBUG" => "1" } if Bundler.rubygems.provides?(">= 2.1.0") - expect(out).to match(/[1-3]: /) + expect(out).to match(/^0: /) + expect(out).to match(/^1: /) else expect(out).to include("is not threadsafe") end @@ -56,7 +58,7 @@ expect(out).to match(/faker/) bundle "config jobs" - expect(out).to match(/: "4"/) + expect(out).to match(/: "2"/) end it "works with --standalone" do