Supervisor.Spec.supervise
supervise
, go back to Supervisor.Spec module for more information.
Specs
supervise([spec()], strategy: strategy(), max_restarts: non_neg_integer(), max_seconds: pos_integer() ) :: {:ok, tuple()}
Receives a list of children
(workers or supervisors) to
supervise and a set of options
.
Returns a tuple containing the supervisor specification. This tuple can be
used as the return value of the Supervisor.init/1
callback when implementing a
module-based supervisor.
Examples
supervise(children, strategy: :one_for_one)
Options
:strategy
- the restart strategy option. It can be either:one_for_one
,:rest_for_one
,:one_for_all
, or:simple_one_for_one
. You can learn more about strategies in theSupervisor
module docs.:max_restarts
- the maximum number of restarts allowed in a time frame. Defaults to3
.:max_seconds
- the time frame in which:max_restarts
applies. Defaults to5
.
The :strategy
option is required and by default a maximum of 3 restarts is
allowed within 5 seconds. Check the Supervisor
module for a detailed
description of the available strategies.