Module: Anycable::HealthServer

Defined in:
lib/anycable/health_server.rb

Overview

Server for HTTP healthchecks

Class Method Summary collapse

Class Method Details

.running?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/anycable/health_server.rb', line 24

def running?
  @health_server&.status == :Running
end

.start(port) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/anycable/health_server.rb', line 10

def start(port)
  return if running?

  @health_server ||= build_server(port)
  Thread.new { @health_server.start }

  Anycable.logger.info "HTTP health server is listening on #{port}"
end

.stopObject



19
20
21
22
# File 'lib/anycable/health_server.rb', line 19

def stop
  return unless running?
  @health_server.shutdown
end