Class: HealthCheck::RedisHealthCheck

Inherits:
Object
  • Object
show all
Extended by:
BaseHealthCheck
Defined in:
lib/health_check/redis_health_check.rb

Class Method Summary collapse

Methods included from BaseHealthCheck

create_error

Class Method Details

.checkObject



8
9
10
11
12
13
14
15
16
# File 'lib/health_check/redis_health_check.rb', line 8

def check
  raise "Wrong configuration. Missing 'redis' gem" unless defined?(::Redis)

  client.ping == 'PONG' ? '' : "Redis.ping returned #{res.inspect} instead of PONG"
rescue Exception => err
  create_error 'redis', err.message
ensure
  client.disconnect
end

.clientObject



18
19
20
# File 'lib/health_check/redis_health_check.rb', line 18

def client
  Redis.new(url: HealthCheck.redis_url)
end