Class: OkComputer::ResqueDownCheck
- Defined in:
- lib/ok_computer/built_in_checks/resque_down_check.rb
Constant Summary
Constants inherited from Check
Instance Attribute Summary
Attributes inherited from Check
#failure_occurred, #message, #registrant_name, #time
Instance Method Summary collapse
-
#check ⇒ Object
Public: Check whether Resque workers are working.
-
#queued? ⇒ Boolean
Public: Whether the given Resque queue has jobs.
-
#working? ⇒ Boolean
Public: Whether the Resque has workers working on a job.
Methods inherited from Check
#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking
Instance Method Details
#check ⇒ Object
Public: Check whether Resque workers are working
4 5 6 7 8 9 10 11 |
# File 'lib/ok_computer/built_in_checks/resque_down_check.rb', line 4 def check if queued? and not working? mark_failure "Resque is DOWN. No workers are working the queue." else "Resque is working" end end |
#queued? ⇒ Boolean
Public: Whether the given Resque queue has jobs
Returns a Boolean
16 17 18 |
# File 'lib/ok_computer/built_in_checks/resque_down_check.rb', line 16 def queued? Resque.info.fetch(:pending) > 10 end |
#working? ⇒ Boolean
Public: Whether the Resque has workers working on a job
Returns a Boolean
23 24 25 |
# File 'lib/ok_computer/built_in_checks/resque_down_check.rb', line 23 def working? Resque.info.fetch(:working) > 0 end |