Class: OkComputer::ResqueFailureThresholdCheck

Inherits:
SizeThresholdCheck show all
Defined in:
lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb

Constant Summary

Constants inherited from Check

Check::CheckNotDefined

Instance Attribute Summary collapse

Attributes inherited from SizeThresholdCheck

#name, #size_proc

Attributes inherited from Check

#failure_occurred, #message, #registrant_name, #time

Instance Method Summary collapse

Methods inherited from SizeThresholdCheck

#check

Methods inherited from Check

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

Constructor Details

#initialize(threshold) ⇒ ResqueFailureThresholdCheck

Public: Initialize a check for a backed-up Resque queue

threshold - An Integer to compare the queue’s count against to consider

it backed up


9
10
11
12
# File 'lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb', line 9

def initialize(threshold)
  self.threshold = Integer(threshold)
  self.name = "Resque Failed Jobs"
end

Instance Attribute Details

#thresholdObject

Returns the value of attribute threshold.



3
4
5
# File 'lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb', line 3

def threshold
  @threshold
end

Instance Method Details

#sizeObject

Public: The number of jobs in the check’s queue



15
16
17
# File 'lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb', line 15

def size
  Resque::Failure.count
end