Supervisor.Spec.supervise

You're seeing just the function supervise, go back to Supervisor.Spec module for more information.
Link to this function

supervise(children, options)

View Source
This function is deprecated. Use the new child specifications outlined in the Supervisor module instead.

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 the Supervisor module docs.

  • :max_restarts - the maximum number of restarts allowed in a time frame. Defaults to 3.

  • :max_seconds - the time frame in which :max_restarts applies. Defaults to 5.

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.