lib/zold/remotes.rb in zold-0.22.0 vs lib/zold/remotes.rb in zold-0.22.1
- old
+ new
@@ -29,10 +29,11 @@
require 'fileutils'
require 'backtrace'
require 'zold/score'
require_relative 'age'
require_relative 'http'
+require_relative 'hands'
require_relative 'thread_pool'
require_relative 'node/farm'
# The list of remotes.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -186,10 +187,10 @@
# Go through the list of remotes and call a provided block for each
# of them. See how it's used, for example, in fetch.rb.
def iterate(log, farm: Farm::Empty.new)
raise 'Log can\'t be nil' if log.nil?
raise 'Farm can\'t be nil' if farm.nil?
- ThreadPool.new('remotes', log: log).run(Concurrent.processor_count * 4, all) do |r, idx|
+ Hands.exec(Concurrent.processor_count * 4, all) do |r, idx|
Thread.current.name = "remotes-#{idx}@#{r[:host]}:#{r[:port]}"
start = Time.now
best = farm.best[0]
begin
yield RemoteNode.new(