Class: HttpHealthCheck::Probes::Sidekiq

Inherits:
Object
  • Object
show all
Includes:
HttpHealthCheck::Probe
Defined in:
lib/http_health_check/probes/sidekiq.rb

Constant Summary collapse

TTL_SEC =
3
MAGIC_NUMBER =
42

Instance Method Summary collapse

Methods included from HttpHealthCheck::Probe

#call, #probe_error, #probe_ok, #with_error_handler

Constructor Details

#initialize(sidekiq: ::Sidekiq) ⇒ Sidekiq

Returns a new instance of Sidekiq.



11
12
13
# File 'lib/http_health_check/probes/sidekiq.rb', line 11

def initialize(sidekiq: ::Sidekiq)
  @sidekiq_module = sidekiq
end

Instance Method Details

#metaObject



22
23
24
# File 'lib/http_health_check/probes/sidekiq.rb', line 22

def meta
  @meta ||= { redis_key: redis_key }
end

#probe(_env) ⇒ Object



15
16
17
18
19
20
# File 'lib/http_health_check/probes/sidekiq.rb', line 15

def probe(_env)
  @sidekiq_module.redis do |conn|
    conn.call('SET', meta[:redis_key], MAGIC_NUMBER, 'EX', TTL_SEC)
    probe_ok
  end
end