Class: Smith::Commands::Restart
- Inherits:
-
Smith::CommandBase
- Object
- Smith::CommandBase
- Smith::Commands::Restart
- Includes:
- Common
- Defined in:
- lib/smith/commands/agency/restart.rb
Instance Attribute Summary
Attributes inherited from Smith::CommandBase
Instance Method Summary collapse
Methods included from Common
Methods inherited from Smith::CommandBase
#banner, #format_help, #initialize, #parse_options
Methods included from Logger
Constructor Details
This class inherits a constructor from Smith::CommandBase
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/smith/commands/agency/restart.rb', line 14 def execute Messaging::Sender.new(QueueDefinitions::Agency_control) do |sender| @sender = sender # agent is a method and as such I cannot pass it into the block. # This just assigns it to a local method making it all work. lagents = agents # lagents.each do |agent_name| worker = ->(agent_name, iter) do lagents[agent_name].stop lagents[agent_name].add_callback(:acknowledge_stop) do lagents.invalidate(agent_name) lagents[agent_name].start end iter.next end done = -> { responder.succeed('') } EM::Iterator.new(target).each(worker, done) end end |