lib/zold/remotes.rb
def iterate(log, farm: Farm::Empty.new, threads: 1)
      raise 'Log can\'t be nil' if log.nil?
      raise 'Farm can\'t be nil' if farm.nil?
      Hands.exec(threads, all) do |r, idx|
        Thread.current.name = "remotes-#{idx}@#{r[:host]}:#{r[:port]}"
        start = Time.now
        best = farm.best[0]
        node = RemoteNode.new(
          host: r[:host],
          port: r[:port],
          score: best.nil? ? Score::ZERO : best,
          idx: idx,
          master: master?(r[:host], r[:port]),
          log: log,
          network: @network
        )
        begin
          yield node
          raise 'Took too long to execute' if (Time.now - start).round > @timeout
          unerror(r[:host], r[:port]) if node.touched
        rescue StandardError => e
          error(r[:host], r[:port])
          if e.is_a?(RemoteNode::CantAssert) || e.is_a?(Fetch::Error)
            log.debug("#{Rainbow(node).red}: \"#{e.message.strip}\" in #{Age.new(start)}")
          else
            log.info("#{Rainbow(node).red}: \"#{e.message.strip}\" in #{Age.new(start)}")
            log.debug(Backtrace.new(e).to_s)
          end
          remove(r[:host], r[:port]) if r[:errors] > TOLERANCE
        end
      end
    end
def iterate(log, farm: Farm::Empty.new, threads: 1)
      raise 'Log can\'t be nil' if log.nil?
      raise 'Farm can\'t be nil' if farm.nil?
      Hands.exec(threads, all) do |r, idx|
        Thread.current.name = "remotes-#{idx}@#{r[:host]}:#{r[:port]}"
        start = Time.now
        best = farm.best[0]
        node = RemoteNode.new(
          host: r[:host],
          port: r[:port],
          score: best.nil? ? Score::ZERO : best,
          idx: idx,
          master: master?(r[:host], r[:port]),
          log: log,
          network: @network
        )
        begin
          yield node
          raise 'Took too long to execute' if (Time.now - start).round > @timeout
          unerror(r[:host], r[:port]) if node.touched
        rescue StandardError => e
          error(r[:host], r[:port])
          if e.is_a?(RemoteNode::CantAssert) || e.is_a?(Fetch::Error)
            log.debug("#{Rainbow(node).red}: \"#{e.message.strip}\" in #{Age.new(start)}")
          else
            log.info("#{Rainbow(node).red}: \"#{e.message.strip}\" in #{Age.new(start)}")
            log.debug(Backtrace.new(e).to_s)
          end
          remove(r[:host], r[:port]) if r[:errors] > TOLERANCE
        end
      end
    end
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.