Class: Autoscale::Agent::WebDispatchers
- Inherits:
-
Object
- Object
- Autoscale::Agent::WebDispatchers
- Includes:
- Enumerable
- Defined in:
- lib/autoscale/agent/web_dispatchers.rb
Defined Under Namespace
Classes: AlreadySetError
Constant Summary collapse
- DISPATCH_INTERVAL =
15
Instance Attribute Summary collapse
-
#queue_time ⇒ Object
Returns the value of attribute queue_time.
Instance Method Summary collapse
- #dispatch ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ WebDispatchers
constructor
A new instance of WebDispatchers.
- #prune ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ WebDispatchers
Returns a new instance of WebDispatchers.
13 14 15 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 13 def initialize @dispatchers = [] end |
Instance Attribute Details
#queue_time ⇒ Object
Returns the value of attribute queue_time.
11 12 13 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 11 def queue_time @queue_time end |
Instance Method Details
#dispatch ⇒ Object
30 31 32 33 34 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 30 def dispatch each(&:dispatch) rescue => err puts "Autoscale::Agent/WebDispatcher: #{err}\n#{err.backtrace.join("\n")}" end |
#each(&block) ⇒ Object
22 23 24 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 22 def each(&block) @dispatchers.each(&block) end |
#prune ⇒ Object
26 27 28 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 26 def prune each(&:prune) end |
#run ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/autoscale/agent/web_dispatchers.rb', line 36 def run Thread.new do loop do prune dispatch sleep DISPATCH_INTERVAL end end end |