YC
id отличается для start_childSize: a a a
YC
id отличается для start_childAK
child процесс из супервизора. id для этого как раз подходит.YC
child процесс из супервизора. id для этого как раз подходит.children = [
%{id: :one, start: {Browser, :start_link, [[:hello]]}},
%{id: :two, start: {Browser, :start_link, [[:hello]]}},
]
{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)
info] terminating: #PID<0.642.0>: :shutdown
** (EXIT from #PID<0.499.0>) shell process exited with reason: shutdown: failed to start child: :two
** (EXIT) already started: #PID<0.642.0>
AK
children = [
%{id: :one, start: {Browser, :start_link, [[:hello]]}},
%{id: :two, start: {Browser, :start_link, [[:hello]]}},
]
{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)
info] terminating: #PID<0.642.0>: :shutdown
** (EXIT from #PID<0.499.0>) shell process exited with reason: shutdown: failed to start child: :two
** (EXIT) already started: #PID<0.642.0>
ŹR
children = [
%{id: :one, start: {Browser, :start_link, [[:hello]]}},
%{id: :two, start: {Browser, :start_link, [[:hello]]}},
]
{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)
info] terminating: #PID<0.642.0>: :shutdown
** (EXIT from #PID<0.499.0>) shell process exited with reason: shutdown: failed to start child: :two
** (EXIT) already started: #PID<0.642.0>
ŹR
Е
defmodule Foo do
use GenServer
def start_link(_), do: GenServer.start_link(Foo, nil)
def init(_), do: {:ok, nil}
end
Supervisor.start_link(
[
%{id: :one, start: {Foo, :start_link, [nil]}},
%{id: :two, start: {Foo, :start_link, [nil]}}
],
strategy: :one_for_one
)
Е
Е
Browser.start_link/1 каким-то чудом возвращает все время один и тот же pid?ŹR
Е
Е
ŹR
Е
ŹR
Е
Е
AK
ŹR
ŹR