diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-01-04 20:50:18 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-01-25 10:49:51 -0600 |
commit | 4498b288635bb6a9d14052414768ea1b84ec01be (patch) | |
tree | 6609133d71d54fbe8eb721f7e043ef573a114c07 /lib/bundler/vendor | |
parent | aef6682fcfd3bf7eb6f75a2c2f5dbdaca7e44743 (diff) | |
download | bundler-4498b288635bb6a9d14052414768ea1b84ec01be.tar.gz |
[CompactIndexClient] Remove dependency upon Bundler::Worker
Diffstat (limited to 'lib/bundler/vendor')
-rw-r--r-- | lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb index 6fb482e2..a919f1e9 100644 --- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb @@ -1,6 +1,5 @@ require "pathname" require "set" -require "bundler/worker" class Bundler::CompactIndexClient require "bundler/vendor/compact_index_client/lib/compact_index_client/cache" @@ -9,12 +8,20 @@ class Bundler::CompactIndexClient attr_reader :directory + # @return [Lambda] A lambda that takes an array of inputs and a block, and + # maps the inputs with the block in parallel. + # + attr_accessor :in_parallel + def initialize(directory, fetcher) @directory = Pathname.new(directory) @updater = Updater.new(fetcher) @cache = Cache.new(@directory) @endpoints = Set.new @info_checksums_by_name = {} + @in_parallel = lambda do |inputs, &blk| + inputs.map(&blk) + end end def names @@ -28,13 +35,9 @@ class Bundler::CompactIndexClient versions end - def dependencies(names, pool_size = 25) - update = Proc.new {|name, _| update_info(name); name } - worker = Bundler::Worker.new(pool_size, update) - names.each {|name| worker.enq(name) } - - names.map do - name = worker.deq + def dependencies(names) + in_parallel.call(names) do |name| + update_info(name) @cache.dependencies(name).map {|d| d.unshift(name) } end.flatten(1) end |