Class: Zold::Routines::Spread
- Inherits:
-
Object
- Object
- Zold::Routines::Spread
- Defined in:
- lib/zold/commands/routines/spread.rb
Overview
Spread them
Instance Method Summary collapse
- #exec(_ = 0) ⇒ Object
-
#initialize(opts, wallets, remotes, log: Log::Quiet.new) ⇒ Spread
constructor
A new instance of Spread.
Constructor Details
Instance Method Details
#exec(_ = 0) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zold/commands/routines/spread.rb', line 43 def exec(_ = 0) return if @remotes.all.empty? if @opts['routine-immediately'] @log.info('Spreading the wallets immediately, because of --routine-immediately') else sleep(60) end ids = @wallets.all.sample(10) Push.new(wallets: @wallets, remotes: @remotes, log: @log).run( ['push', "--network=#{@opts['network']}"] + ids.map(&:to_s) ) if ids.empty? @log.info("Spread didn't push any wallets, we are empty") else @log.info("Spread #{ids.count} random wallets out of #{@wallets.all.count}: #{ids.join(', ')}") end end |