I’ve been reading about Task.async_stream_nolink, which would iterate collection into heavy function using spawned process, which is what I want, as linked process would cause crashing all other tasks related to processing the collection.
The question is, how would I tell the supervisor not to spawn a new process when fails? or at least to decide to recover the process based on the state of failed process?
As sometimes, I don’t need to recover process after failed.
My supervisor looks like this:
defmodule MyApp.Supervisor do
# Automatically defines child_spec/1
use Supervisor
def start_link(arg) do
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
end
def init(_arg) do
Supervisor.init([
{Stack, [:hello]}
], strategy: :one_for_one)
end
end