Class: Autoscale::Agent::WorkerDispatchers
- Inherits:
-
Object
- Object
- Autoscale::Agent::WorkerDispatchers
- Includes:
- Enumerable
- Defined in:
- lib/autoscale/agent/worker_dispatchers.rb
Constant Summary collapse
- DISPATCH_INTERVAL =
15
Instance Method Summary collapse
- #<<(dispatcher) ⇒ Object
- #dispatch ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ WorkerDispatchers
constructor
A new instance of WorkerDispatchers.
- #run ⇒ Object
Constructor Details
#initialize ⇒ WorkerDispatchers
Returns a new instance of WorkerDispatchers.
8 9 10 |
# File 'lib/autoscale/agent/worker_dispatchers.rb', line 8 def initialize @dispatchers = [] end |
Instance Method Details
#<<(dispatcher) ⇒ Object
16 17 18 |
# File 'lib/autoscale/agent/worker_dispatchers.rb', line 16 def <<(dispatcher) @dispatchers << dispatcher end |
#dispatch ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/autoscale/agent/worker_dispatchers.rb', line 20 def dispatch each do |dispatcher| dispatcher.dispatch rescue => err puts "Autoscale::Agent/WorkerDispatcher: #{err}\n#{err.backtrace.join("\n")}" end end |
#each(&block) ⇒ Object
12 13 14 |
# File 'lib/autoscale/agent/worker_dispatchers.rb', line 12 def each(&block) @dispatchers.each(&block) end |
#run ⇒ Object
28 29 30 |
# File 'lib/autoscale/agent/worker_dispatchers.rb', line 28 def run Util.loop_with_interval(DISPATCH_INTERVAL) { dispatch } end |