Class: OkComputer::ResqueDownCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/ok_computer/built_in_checks/resque_down_check.rb

Constant Summary

Constants inherited from Check

Check::CheckNotDefined

Instance Attribute Summary

Attributes inherited from Check

#failure_occurred, #message, #registrant_name, #time

Instance Method Summary collapse

Methods inherited from Check

#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking

Instance Method Details

#checkObject

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
    mark_message "Resque is DOWN. No workers are working the queue."
  else
    mark_message "Resque is working"
  end
end

#queued?Boolean

Public: Whether the given Resque queue has jobs

Returns a Boolean

Returns:

  • (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

Returns:

  • (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