lib/zold/remotes.rb in zold-0.13.46 vs lib/zold/remotes.rb in zold-0.14.0

- old
+ new

@@ -37,10 +37,16 @@ PORT = 4096 # At what amount of errors we delete the remote automatically TOLERANCE = 8 + # After this limit, the remote runtime must be recorded + RUNTIME_LIMIT = 16 + + # Default number of nodes to fetch. + MAX_NODES = 16 + # Empty, for standalone mode class Empty < Remotes def initialize # Nothing here end @@ -178,9 +184,10 @@ all.each do |r| start = Time.now begin yield Remotes::Remote.new(r[:host], r[:port], score, idx, log: log, network: @network) idx += 1 + raise 'Took too long to execute' if (Time.now - start).round > Remotes::RUNTIME_LIMIT rescue StandardError => e error(r[:host], r[:port]) errors = errors(r[:host], r[:port]) log.info("#{Rainbow("#{r[:host]}:#{r[:port]}").red}: #{e.message} \ in #{(Time.now - start).round}s; errors=#{errors}")