Method: OkComputer::DelayedJobBackedUpCheck#initialize

Defined in:
lib/ok_computer/built_in_checks/delayed_job_backed_up_check.rb

#initialize(priority, threshold, options = {}) ⇒ DelayedJobBackedUpCheck

Public: Initialize a check for backed-up Delayed Job jobs

priority - Which priority to check for threshold - An Integer to compare the jobs count against to consider it backed up options - Hash of optional parameters

queue - Used to monitor a specific delayed job queue (default: nil)
include_locked - If true, will include currently locked jobs in the query (default: false)
include_errored - If true, will include currently errored jobs in the query (default: false)
greater_than_priority - If true, will include all jobs with a priority value equal or greater than the set value.

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


25
26
27
28
29
30
31
32
33
# File 'lib/ok_computer/built_in_checks/delayed_job_backed_up_check.rb', line 25

def initialize(priority, threshold, options = {})
  self.priority = Integer(priority)
  self.threshold = Integer(threshold)
  self.queue = options[:queue]
  self.include_locked = !!options[:include_locked]
  self.include_errored = !!options[:include_errored]
  self.greater_than_priority = !!options[:greater_than_priority]
  self.name = greater_than_priority ? "Delayed Jobs with priority higher than '#{priority}'" : "Delayed Jobs with priority lower than '#{priority}'"
end