fettle v0.1.0 Fettle.Runner View Source
Runs a health check periodically.
The start_link/4
function is called by the Fettle.RunnerSupervisor
to start the server,
passing the check spec, and Checker
module to run.
When a check is scheduled to run, the server spawns the check function in a separate, monitored process,
which will send the result back to the runner as a Fettle.Checker.Result
.
The first check execution is scheduled after an initial delay (:initial_delay_ms
), then the
check is scheduled to run :period_ms
after completion of the previous check. i.e. the period
does not include the time it takes to actually run the check, just the time between completions
(or time-outs); effectively the period defines the maximum rate that a check will run.
If a timeout (:timeout_ms
) occurs before a result is received, the check enters error status,
and the spawned checker process is killed by the Runner
.
Results are forwarded to the Fettle.ScoreBoard
process.
See also
Fettle.RunnerSupervisor
- starts and supervisesRunner
processes.
Link to this section Summary
Functions
start the runner for the given check
Link to this section Types
checker_init() :: {checker :: module, init_args :: any}
t() :: %Fettle.Runner{checker_fun: function, checker_state: any, id: String.t, period_ms: integer, result: Fettle.Checker.Result.t, scoreboard: atom, task: {pid, reference} | nil, timeout_ms: integer}
runner state
Link to this section Functions
start_link(config :: Fettle.Config.t, spec :: Fettle.Spec.t, checker_init, opts :: Keyword.t) :: GenServer.on_start
start the runner for the given check.