I am working through the elixir-lang getting started guide and I am confused why a task assigned to the supervision tree wont restart automatically.
def start(_type, _args) do
children = [
{Task, fn -> KVServer.accept(4040) end}
]
opts = [strategy: :one_for_one, name: KVServer.Supervisor]
Supervisor.start_link(children, opts)
end
I see that the next section outlays Task.Supervisor, etc and there are more bits that can restart a task, but should the above not be enough for the main supervisor to see a task crash (do-able here by connecting and disconnecting, no replacement “server” is started) and to just call “start_link” with the child spec?