From 1a960d35e78945fa41da006894d137680fb178cc Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Mon, 28 Nov 2016 12:31:27 -0600 Subject: [CompactIndexClient] Synchronize access to the list of fetched endpoints --- lib/bundler/compact_index_client.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bundler/compact_index_client.rb b/lib/bundler/compact_index_client.rb index c3a1b69c6f..3ed05ca484 100644 --- a/lib/bundler/compact_index_client.rb +++ b/lib/bundler/compact_index_client.rb @@ -29,6 +29,7 @@ module Bundler @endpoints = Set.new @info_checksums_by_name = {} @parsed_checksums = false + @mutex = Mutex.new @in_parallel = lambda do |inputs, &blk| inputs.map(&blk) end @@ -73,7 +74,7 @@ module Bundler def update(local_path, remote_path) Bundler::CompactIndexClient.debug { "update(#{local_path}, #{remote_path})" } - unless @endpoints.add?(remote_path) + unless synchronize { @endpoints.add?(remote_path) } Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" } return end @@ -99,5 +100,9 @@ module Bundler def url(path) path end + + def synchronize + @mutex.synchronize { yield } + end end end -- cgit v1.2.1 From e584033855c5fde0e2746fbcd5ede3257ba7d098 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Mon, 28 Nov 2016 14:19:09 -0600 Subject: =?UTF-8?q?[Fetcher::CompactIndex]=20Don=E2=80=99t=20run=20in=20pa?= =?UTF-8?q?rallel=20on=20RBX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a temporary measure until we can ensure everything is properly synchronized --- lib/bundler/fetcher/compact_index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index 38105a3f8f..5d703a3a78 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -95,7 +95,7 @@ module Bundler def bundle_worker(func = nil) @bundle_worker ||= begin worker_name = "Compact Index (#{display_uri.host})" - Bundler::Worker.new(25, worker_name, func) + Bundler::Worker.new(Bundler.current_ruby.rbx? ? 1 : 25, worker_name, func) end @bundle_worker.tap do |worker| worker.instance_variable_set(:@func, func) if func -- cgit v1.2.1 From cdc772c374aa8b8cc4daadaf59c09e2055d7c705 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Mon, 28 Nov 2016 14:19:29 -0600 Subject: Fix a spelling mistake in the specs --- spec/bundler/bundler_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb index cf6de26ac3..1b72f7fd42 100644 --- a/spec/bundler/bundler_spec.rb +++ b/spec/bundler/bundler_spec.rb @@ -156,7 +156,7 @@ describe Bundler do describe "#rm_rf" do context "the directory is world writable" do let(:bundler_ui) { Bundler.ui } - it "should show a fridenly error" do + it "should raise a friendly error" do allow(File).to receive(:exist?).and_return(true) allow(FileUtils).to receive(:remove_entry_secure).and_raise(ArgumentError) allow(File).to receive(:world_writable?).and_return(true) -- cgit v1.2.1