Class: Async::App::WebApps::HealthApp

Inherits:
Object
  • Object
show all
Includes:
AutoloadComponent, Async::App::WebComponent
Defined in:
lib/async/app/web_apps/health_app.rb

Constant Summary collapse

PATHS =
["/health", "/health/"].freeze

Instance Method Summary collapse

Methods included from AutoloadComponent

included

Methods included from Async::App::WebComponent

included

Instance Method Details

#after_initObject



9
10
11
12
# File 'lib/async/app/web_apps/health_app.rb', line 9

def after_init
  @healthy = false
  bus.subscribe("health.updated") { @healthy = _1 }
end

#call(_) ⇒ Object



15
# File 'lib/async/app/web_apps/health_app.rb', line 15

def call(_) = [@healthy ? 200 : 500]

#can_handle?(request) ⇒ Boolean

Returns:

  • (Boolean)


14
# File 'lib/async/app/web_apps/health_app.rb', line 14

def can_handle?(request) = PATHS.include?(request.path)