class SidekiqLiveness::Server
Public Class Methods
call(env)
click to toggle source
# File lib/sidekiq_liveness/server.rb, line 16 def call(env) case Rack::Request.new(env).path when "/healthz" [SidekiqLiveness.alive? ? 200 : 500, {}, [""]] when "/stop" SidekiqLiveness.stop! [200, {}, [""]] else [404, {}, [""]] end end
run!()
click to toggle source
# File lib/sidekiq_liveness/server.rb, line 8 def run! handler = Rack::Handler.get("webrick") Signal.trap("TERM") { handler.shutdown } handler.run(self, Port: port, Host: host) end
Private Class Methods
host()
click to toggle source
# File lib/sidekiq_liveness/server.rb, line 34 def host ENV.fetch("SIDEKIQ_LIVENESS_HOST") { "0.0.0.0" } end
port()
click to toggle source
# File lib/sidekiq_liveness/server.rb, line 30 def port ENV.fetch("SIDEKIQ_LIVENESS_PORT") { 7433 } end