summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2016-11-29 20:42:05 +0000
committerThe Bundler Bot <bot@bundler.io>2016-11-29 20:42:05 +0000
commitae4f036d9536ae926421a24667ba68149eb13399 (patch)
treed07fad86343af23ffbfe040f33186ce3cad3837a /lib
parent73f2b99bd391a9e355b6f1d1fd8ca9dcf1372fd1 (diff)
parentcdc772c374aa8b8cc4daadaf59c09e2055d7c705 (diff)
downloadbundler-ae4f036d9536ae926421a24667ba68149eb13399.tar.gz
Auto merge of #5213 - bundler:seg-compact-index-client-threadsafe, r=indirect
[CompactIndexClient] Synchronize access to the list of fetched endpoints Should fix #5142.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/compact_index_client.rb7
-rw-r--r--lib/bundler/fetcher/compact_index.rb2
2 files changed, 7 insertions, 2 deletions
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
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