lib/zold/commands/fetch.rb in zold-0.16.16 vs lib/zold/commands/fetch.rb in zold-0.16.17
- old
+ new
@@ -88,25 +88,24 @@
end
raise "There are no remote nodes, run 'zold remote reset'" if nodes.value.zero?
raise "No nodes out of #{nodes.value} have the wallet #{id}" if done.value.zero? && !opts['quiet-if-absent']
@log.info("#{done.value} copies of #{id} fetched in #{Age.new(start)} with the total score of \
#{total.value} from #{nodes.value} nodes")
- @log.debug("#{cps.all.count} local copies:")
- cps.all.each do |c|
- wallet = Wallet.new(c[:path])
- @log.debug(" #{c[:name]}: #{c[:score]} #{wallet.mnemo} \
-#{Size.new(File.size(c[:path]))}/#{Age.new(File.mtime(c[:path]))}")
+ list = cps.all.map do |c|
+ " ##{c[:name]}: #{c[:score]} #{Wallet.new(c[:path]).mnemo} \
+#{Size.new(File.size(c[:path]))}/#{Age.new(File.mtime(c[:path]))}"
end
+ @log.debug("#{cps.all.count} local copies of #{id}:\n#{list.join("\n")}")
end
def fetch_one(id, r, cps, opts)
start = Time.now
if opts['ignore-node'].include?(r.to_s)
@log.debug("#{r} ignored because of --ignore-node")
return 0
end
uri = "/wallet/#{id}"
- res = r.http(uri).get
+ res = r.http(uri).get(timeout: 60)
raise "Wallet #{id} not found" if res.code == '404'
r.assert_code(200, res)
json = JsonPage.new(res.body, uri).to_hash
score = Score.parse_json(json['score'])
r.assert_valid_score(score)