Shared health-polling logic for engine GenServers.
Both Candil.Engine.Server and Candil.Engine.Server.External poll
<base_url>/health every 5 seconds. This module provides the common
probe_health/1 function and macros/clauses for the repeated
handle_call(:health, ...), handle_call(:base_url, ...) and
handle_info(:poll_health, ...) patterns.
Summary
Functions
Implements GenServer.handle_call/3 for :health and :base_url.
Implements the :poll_health timer message.
Returns the initial state map with healthy: false.
Returns the poll interval in milliseconds.
Probe base_url/health and return true if reachable (HTTP 200).
Functions
Implements GenServer.handle_call/3 for :health and :base_url.
Use from your GenServer via:
def handle_call(:health, _from, state), do: HealthPoller.handle_health_call(state)
def handle_call(:base_url, _from, state), do: HealthPoller.handle_base_url_call(state, state.base_url)
Implements the :poll_health timer message.
Call from your GenServer's handle_info/2:
def handle_info(:poll_health, state), do: HealthPoller.handle_poll_health(state)
Returns the initial state map with healthy: false.
@spec poll_interval() :: pos_integer()
Returns the poll interval in milliseconds.
Probe base_url/health and return true if reachable (HTTP 200).