Class: RailsHealthChecks::Checks::ResqueCheck
- Inherits:
-
RailsHealthChecks::Check
- Object
- RailsHealthChecks::Check
- RailsHealthChecks::Checks::ResqueCheck
- Defined in:
- lib/rails_health_checks/checks/resque_check.rb
Instance Attribute Summary
Attributes inherited from RailsHealthChecks::Check
#latency_ms, #message, #status
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(queue_size: nil) ⇒ ResqueCheck
constructor
A new instance of ResqueCheck.
Constructor Details
#initialize(queue_size: nil) ⇒ ResqueCheck
Returns a new instance of ResqueCheck.
6 7 8 9 10 11 12 |
# File 'lib/rails_health_checks/checks/resque_check.rb', line 6 def initialize(queue_size: nil) unless defined?(::Resque) raise LoadError, "Resque is not installed. Add `gem 'resque'` to your Gemfile to use the :resque check." end @queue_size = queue_size end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rails_health_checks/checks/resque_check.rb', line 14 def call measure { ::Resque.redis.ping } if @queue_size depth = ::Resque.queues.sum { |q| ::Resque.size(q) } return warn_with("queue depth #{depth} exceeds threshold #{@queue_size}") if depth > @queue_size end pass rescue StandardError => e fail_with(e.) end |