defmodule App.Agent do
use Agent
def start do
Agent.start_link(fn -> %{} end, name: __MODULE__)
end
end
Using the above, is there any supervision over that agent? How should I approach Agent supervision?
defmodule App.Agent do
use Agent
def start do
Agent.start_link(fn -> %{} end, name: __MODULE__)
end
end
Using the above, is there any supervision over that agent? How should I approach Agent supervision?
Hi @NaN, the function you show simply starts an agent linked to the current process. If you add that App.Agent
to a supervisor’s child list, then the supervisor will start it and supervise it. I’d read through this guide here on the official site to get started Introduction to Mix - The Elixir programming language
The Agent
docs have a section addressing your exact question: Agent: How to supervise.