SZ
Size: a a a
SZ
SZ
SZ
defmodule Parent do
use Supervisor
def start_link() do
IO.inspect(__ENV__.line)
Supervisor.start_link(__MODULE__, nil)
end
def init(_) do
start_fetchers()
loop()
end
def start_fetchers do
Process.flag :trap_exit, true
# Process.flag(:trap_exit, true)
children = Elrss.Feeds.Feed
# |> limit(5)
|> Elrss.Repo.all()
|> Enum.map(fn f ->
worker(Fetcher, [f], [id: f.id, restart: :permanent])
end)
{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)
end
def loop do
receive do
{:EXIT, pid, _} = msg->
# IO.puts "Parent got message: #{inspect msg}"
IO.puts "Crashed. Restarting"
start_fetchers()
loop()
end
end
end
ŹR
ŹR
SZ
ŹR
ŹR
ŹR
SZ
DR
DR
:max_restartsМБ
SZ
:max_restartsSZ
ŹR
SZ
MK
AM
[
{:nadia, git: "https://github.com/zhyu/nadia.git"},
{:httpoison, "~> 1.5.1"},
{:plug_cowboy, "~> 2.1"}
]
NM