DynamicSupervisor.init
init
, go back to DynamicSupervisor module for more information.
Specs
init([init_option()]) :: {:ok, sup_flags()}
Receives a set of options
that initializes a dynamic supervisor.
This is typically invoked at the end of the init/1
callback of
module-based supervisors. See the "Module-based supervisors" section
in the module documentation for more information.
The options
received by this function are also supported by start_link/1
.
This function returns a tuple containing the supervisor options.
Examples
def init(_arg) do
DynamicSupervisor.init(max_children: 1000, strategy: :one_for_one)
end
Options
:strategy
- the restart strategy option. The only supported value is:one_for_one
which means that no other child is terminated if a child process terminates. 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
.:max_children
- the maximum amount of children to be running under this supervisor at the same time. When:max_children
is exceeded,start_child/2
returns{:error, :max_children}
. Defaults to:infinity
.:extra_arguments
- arguments that are prepended to the arguments specified in the child spec given tostart_child/2
. Defaults to an empty list.