summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/compact_index_client.rb7
1 files changed, 6 insertions, 1 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