Class: OkComputer::ResqueBackedUpCheck

Inherits:
SizeThresholdCheck show all
Defined in:
lib/ok_computer/built_in_checks/resque_backed_up_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(queue, threshold) ⇒ ResqueBackedUpCheck

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

queue - The name of the Resque queue to check threshold - An Integer to compare the queue’s count against to consider

it backed up


11
12
13
14
15
# File 'lib/ok_computer/built_in_checks/resque_backed_up_check.rb', line 11

def initialize(queue, threshold)
  self.queue = queue
  self.threshold = Integer(threshold)
  self.name = "Resque queue '#{queue}'"
end

Instance Attribute Details

#queueObject

Returns the value of attribute queue.



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

def queue
  @queue
end

#thresholdObject

Returns the value of attribute threshold.



4
5
6
# File 'lib/ok_computer/built_in_checks/resque_backed_up_check.rb', line 4

def threshold
  @threshold
end

Instance Method Details

#sizeObject

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



18
19
20
# File 'lib/ok_computer/built_in_checks/resque_backed_up_check.rb', line 18

def size
  Resque.size(queue)
end