Sha256: 4c529d27d927c655ec1938b9320fa4edd0025a2e838b478b9a7fd2c0d3f70f85

Contents?: true

Size: 346 Bytes

Versions: 2

Compression:

Stored size: 346 Bytes

Contents

# frozen_string_literal: true

class Async::App::WebServer::HealthApp
  include Async::App::Component

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

  def initialize
    @healthy = false

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

  def can_handle?(request) = PATHS.include?(request.path)
  def call(_) = [@healthy ? 200 : 500]
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
async-tools-0.2.9 lib/async/app/web_server/health_app.rb
async-tools-0.2.8 lib/async/app/web_server/health_app.rb