Method: OkComputer::SizeThresholdCheck#check

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

#checkObject

Public: Check whether the given queue is backed up



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ok_computer/built_in_checks/size_threshold_check.rb', line 27

def check
  # Memoize size here to prevent a theoretically
  # expensive operation from happening more than once
  size = self.size
  if size <= threshold
    mark_message "#{name} at reasonable level (#{size})"
  else
    mark_failure
    mark_message "#{name} is #{size - threshold} over threshold! (#{size})"
  end
rescue ArgumentError, TypeError => e
  mark_failure
  mark_message "The given proc MUST return a number (#{e.class})"
rescue StandardError => e
  mark_failure
  mark_message "An error occurred: '#{e.message}' (#{e.class})"
end