Sha256: 8dae5f7cee4491d2bde16a9cd87338128896719e777e85e4f0933e6c1c94aa87
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
class Kamal::Utils::HealthcheckPoller TRAEFIK_HEALTHY_DELAY = 2 class HealthcheckError < StandardError; end class << self def wait_for_healthy(pause_after_ready: false, &block) attempt = 1 max_attempts = KAMAL.config.healthcheck["max_attempts"] begin case status = block.call when "healthy" sleep TRAEFIK_HEALTHY_DELAY if pause_after_ready when "running" # No health check configured sleep KAMAL.config.readiness_delay if pause_after_ready else raise HealthcheckError, "container not ready (#{status})" end rescue HealthcheckError => e if attempt <= max_attempts info "#{e.message}, retrying in #{attempt}s (attempt #{attempt}/#{max_attempts})..." sleep attempt attempt += 1 retry else raise end end info "Container is healthy!" end private def info(message) SSHKit.config.output.info(message) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kamal-0.16.1 | lib/kamal/utils/healthcheck_poller.rb |
kamal-0.16.0 | lib/kamal/utils/healthcheck_poller.rb |