lib/zold/stress/round.rb in zold-stress-0.6.0 vs lib/zold/stress/round.rb in zold-stress-0.7.0
- old
+ new
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-# Copyright (c) 2018 Yegor Bugayenko
+# Copyright (c) 2018-2019 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -32,11 +32,11 @@
require_relative 'pmnts'
require_relative 'air'
# Stress test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
-# Copyright:: Copyright (c) 2018 Yegor Bugayenko
+# Copyright:: Copyright (c) 2018-2019 Yegor Bugayenko
# License:: MIT
module Zold::Stress
# Full round of stress test
class Round
def initialize(pvt:, wallets:, remotes:, copies:,
@@ -80,11 +80,14 @@
pool.rebuild
@wallets.all.peach(@opts['threads']) do |id|
Thread.current.name = 'prepare-push'
@stats.exec('push') do
Zold::Push.new(wallets: @wallets, remotes: @remotes, log: @vlog).run(
- ['push', id.to_s, "--network=#{@opts['network']}"] + @opts.arguments
+ [
+ 'push', id.to_s, "--network=#{@opts['network']}",
+ '--tolerate-edges', '--tolerate-quorum=1'
+ ] + @opts.arguments
)
end
end
@log.info("There are #{@wallets.all.count} wallets in the pool \
with #{@wallets.all.map { |id| @wallets.acq(id, &:balance) }.inject(&:+)} total, \
@@ -102,11 +105,14 @@
sources = sent.group_by { |p| p[:source] }
sources.peach(@opts['threads']) do |a|
Thread.current.name = 'send-push'
@stats.exec('push') do
Zold::Push.new(wallets: @wallets, remotes: @remotes, log: @vlog).run(
- ['push', a[0].to_s, "--network=#{@opts['network']}"] + @opts.arguments
+ [
+ 'push', a[0].to_s, "--network=#{@opts['network']}",
+ '--tolerate-edges', '--tolerate-quorum=1'
+ ] + @opts.arguments
)
mutex.synchronize do
a[1].each { |p| @air.add(p) }
end
@stats.put('output', @wallets.acq(a[0], &:size))
@@ -124,10 +130,13 @@
targets = @air.fetch.group_by { |p| p[:target] }.map { |a| a[0] }
targets.peach(@opts['threads']) do |id|
Thread.current.name = "pull-#{id}"
@stats.exec('pull') do
Zold::Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @vlog).run(
- ['pull', id.to_s, "--network=#{@opts['network']}", '--skip-propagate'] + @opts.arguments
+ [
+ 'pull', id.to_s, "--network=#{@opts['network']}",
+ '--skip-propagate', '--tolerate-edges', '--tolerate-quorum=1'
+ ] + @opts.arguments
)
end
@air.pulled(id)
@stats.put('input', @wallets.acq(id, &:size))
end