Supervisor.restart_child
restart_child
, go back to Supervisor module for more information.
Specs
restart_child(supervisor(), term()) :: {:ok, child()} | {:ok, child(), term()} | {:error, error} when error: :not_found | :running | :restarting | term()
Restarts a child process identified by child_id
.
The child specification must exist and the corresponding child process must not be running.
Note that for temporary children, the child specification is automatically deleted when the child terminates, and thus it is not possible to restart such children.
If the child process start function returns {:ok, child}
or {:ok, child, info}
,
the PID is added to the supervisor and this function returns the same value.
If the child process start function returns :ignore
, the PID remains set to
:undefined
and this function returns {:ok, :undefined}
.
This function may return an error with an appropriate error tuple if the
child_id
is not found, or if the current process is running or being
restarted.
If the child process start function returns an error tuple or an erroneous value,
or if it fails, this function returns {:error, error}
.