aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-01-04 20:50:35 -0600
committerSamuel Giddins <segiddins@segiddins.me>2016-01-25 10:49:51 -0600
commit48de6e8857bed06dd69f0be4122943d6aa6830d6 (patch)
treecb70eb1bb0558316c435b331fdcf19d7962b1dc1
parent4498b288635bb6a9d14052414768ea1b84ec01be (diff)
downloadbundler-48de6e8857bed06dd69f0be4122943d6aa6830d6.tar.gz
[CompactIndex] Fetch in parallel using Bundler::Worker
-rw-r--r--lib/bundler/fetcher/compact_index.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb
index d58c1659..7381846b 100644
--- a/lib/bundler/fetcher/compact_index.rb
+++ b/lib/bundler/fetcher/compact_index.rb
@@ -1,4 +1,5 @@
require "bundler/fetcher/base"
+require "bundler/worker"
module Bundler
class Fetcher
@@ -69,6 +70,12 @@ module Bundler
SharedHelpers.filesystem_access(cache_path) do
CompactIndexClient.new(cache_path, compact_fetcher)
+ end.tap do |client|
+ client.in_parallel = lambda do |inputs, &blk|
+ worker = Bundler::Worker.new(25, blk)
+ inputs.each {|input| worker.enq(input) }
+ inputs.map { worker.deq }
+ end
end
end
end