Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/bundler/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/installer/parallel_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions spec/realworld/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down