File: sidekiq_health_check.rb

package info (click to toggle)
ruby-health-check 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 256 kB
  • sloc: sh: 1,021; ruby: 596; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 435 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module HealthCheck
  class SidekiqHealthCheck
    extend BaseHealthCheck

    def self.check
      unless defined?(::Sidekiq)
        raise "Wrong configuration. Missing 'sidekiq' gem"
      end
      ::Sidekiq.redis do |r|
        res = r.ping
        res == 'PONG' ? '' : "Sidekiq.redis.ping returned #{res.inspect} instead of PONG"
      end
    rescue Exception => e
      create_error 'sidekiq-redis', e.message
    end
  end
end