Supervising a task, restart behavior of children

In my application, I have a supervisor which is responsible for starting up some processes, and as well as a task

defmodule MySupervisor do
  def init do
    children = [
      {ProcessA, []},
      {MyTask, []}
  Supervisor.init(children, strategy: one_for_all

In the case of ProcessA crashing, the restart strategy indicates to me that the rest of the children should also be restarted. This to me means MyTask will also be restarted.

In another situation, if MyTask crashes, what happens? I read from that Tasks define a child spec :restart is :temporary, meaning it will not be restart even if it crashes. However, this would conflict with the “one_for_all” strategy then? Will all other processes like ProcessA restart? Will MyTask just crash and not restart? What would happen in this situation?

1 Like