lib/zold/stress/round.rb in zold-stress-0.5.0 vs lib/zold/stress/round.rb in zold-stress-0.5.1
- old
+ new
@@ -79,11 +79,11 @@
['push', id.to_s, "--network=#{@opts['network']}"] + @opts.arguments
)
end
end
@log.info("There are #{@wallets.all.count} wallets in the pool \
-with #{@wallets.all.map { |id| @wallets.find(id, &:balance) }.inject(&:+)} total, \
+with #{@wallets.all.map { |id| @wallets.acq(id, &:balance) }.inject(&:+)} total, \
in #{Zold::Age.new(start)}")
end
def send
start = Time.now
@@ -100,11 +100,11 @@
['push', a[0].to_s, "--network=#{@opts['network']}"] + @opts.arguments
)
mutex.synchronize do
a[1].each { |p| @air.add(p) }
end
- @stats.put('output', @wallets.find(a[0], &:size))
+ @stats.put('output', @wallets.acq(a[0], &:size))
end
end
@log.info("#{sent.count} payments for #{sent.map { |s| s[:amount] }.inject(&:+)} \
sent from #{sources.count} wallets, \
in #{Zold::Age.new(start)}, #{@air.fetch.count} are now in the air, \
@@ -120,20 +120,20 @@
Zold::Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @vlog).run(
['pull', id.to_s, "--network=#{@opts['network']}"] + @opts.arguments
)
end
@air.pulled(id)
- @stats.put('input', @wallets.find(id, &:size))
+ @stats.put('input', @wallets.acq(id, &:size))
end
@log.info("There are #{@wallets.all.count} wallets left, \
after the pull of #{targets.count} in #{Zold::Age.new(start)}")
end
def match
total = 0
@air.fetch.each do |p|
- next unless @wallets.find(p[:target], &:exists?)
- t = @wallets.find(p[:target], &:txns).find { |x| x.details == p[:details] && x.bnf == p[:source] }
+ next unless @wallets.acq(p[:target], &:exists?)
+ t = @wallets.acq(p[:target], &:txns).find { |x| x.details == p[:details] && x.bnf == p[:source] }
next if t.nil?
@stats.put('arrived', p[:pulled] - p[:pushed])
total += 1
@log.debug("#{p[:amount]} arrived from #{p[:source]} to #{p[:target]} \
in txn ##{t.id} in #{Zold::Age.new(p[:start])}: #{t.details}")