Module: Resque::Durable::Monitor
- Defined in:
- lib/resque/durable/monitor.rb
Instance Attribute Summary collapse
-
#auditor ⇒ Object
Returns the value of attribute auditor.
-
#expiration ⇒ Object
Returns the value of attribute expiration.
-
#wait_duration ⇒ Object
Returns the value of attribute wait_duration.
Instance Method Summary collapse
- #initialize(auditor) ⇒ Object
- #install_signal_handlers ⇒ Object
- #run ⇒ Object
- #stop ⇒ Object
- #wait ⇒ Object
- #watch ⇒ Object
Instance Attribute Details
#auditor ⇒ Object
Returns the value of attribute auditor.
5 6 7 |
# File 'lib/resque/durable/monitor.rb', line 5 def auditor @auditor end |
#expiration ⇒ Object
Returns the value of attribute expiration.
5 6 7 |
# File 'lib/resque/durable/monitor.rb', line 5 def expiration @expiration end |
#wait_duration ⇒ Object
Returns the value of attribute wait_duration.
5 6 7 |
# File 'lib/resque/durable/monitor.rb', line 5 def wait_duration @wait_duration end |
Instance Method Details
#initialize(auditor) ⇒ Object
7 8 9 |
# File 'lib/resque/durable/monitor.rb', line 7 def initialize(auditor) @auditor = auditor end |
#install_signal_handlers ⇒ Object
34 35 36 37 |
# File 'lib/resque/durable/monitor.rb', line 34 def install_signal_handlers trap('TERM') { stop } trap('INT') { stop } end |
#run ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/resque/durable/monitor.rb', line 16 def run install_signal_handlers loop do watch wait break if @stopped end end |
#stop ⇒ Object
39 40 41 42 |
# File 'lib/resque/durable/monitor.rb', line 39 def stop puts 'Stopping...' @stopped = true end |
#wait ⇒ Object
26 27 28 |
# File 'lib/resque/durable/monitor.rb', line 26 def wait sleep(wait_duration) end |
#watch ⇒ Object
11 12 13 14 |
# File 'lib/resque/durable/monitor.rb', line 11 def watch auditor.recover auditor.cleanup(expiration.ago) end |