Class: OKComputer::DelayedJobBackedUpCheck
- Inherits:
-
SizeThresholdCheck
- Object
- Check
- SizeThresholdCheck
- OKComputer::DelayedJobBackedUpCheck
- Defined in:
- lib/okcomputer/built_in_checks/delayed_job_backed_up_check.rb
Constant Summary
Constants inherited from Check
Check::CALL_DEPRECATION_MESSAGE, Check::CheckNotDefined
Instance Attribute Summary collapse
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
Attributes inherited from SizeThresholdCheck
Attributes inherited from Check
#failure_occurred, #message, #registrant_name
Instance Method Summary collapse
-
#initialize(priority, threshold) ⇒ DelayedJobBackedUpCheck
constructor
Public: Initialize a check for backed-up Delayed Job jobs.
-
#size ⇒ Object
Public: How many delayed jobs are pending within the given priority.
Methods inherited from SizeThresholdCheck
Methods inherited from Check
#clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text
Constructor Details
#initialize(priority, threshold) ⇒ DelayedJobBackedUpCheck
Public: Initialize a check for backed-up Delayed Job jobs
priority - Which priority (or greater) to check for threshold - An Integer to compare the jobs count against to consider it backed up
Example:
check = new(10, 50)
# => The check will look for jobs with priority between
# 0 and 10, considering the jobs as backed up if there
# are more than 50 of them
17 18 19 20 21 |
# File 'lib/okcomputer/built_in_checks/delayed_job_backed_up_check.rb', line 17 def initialize(priority, threshold) self.priority = Integer(priority) self.threshold = Integer(threshold) self.name = "Delayed Jobs within priority '#{priority}'" end |
Instance Attribute Details
#priority ⇒ Object
Returns the value of attribute priority.
3 4 5 |
# File 'lib/okcomputer/built_in_checks/delayed_job_backed_up_check.rb', line 3 def priority @priority end |
#threshold ⇒ Object
Returns the value of attribute threshold.
4 5 6 |
# File 'lib/okcomputer/built_in_checks/delayed_job_backed_up_check.rb', line 4 def threshold @threshold end |
Instance Method Details
#size ⇒ Object
Public: How many delayed jobs are pending within the given priority
24 25 26 |
# File 'lib/okcomputer/built_in_checks/delayed_job_backed_up_check.rb', line 24 def size Delayed::Job.where("priority <= ?", priority).where(:locked_at => nil, :last_error => nil).count end |