Skip to content

Commit fbfba35

Browse files
committed
correctly handle valid errors in syn join when starting children
the previous commit introduced registry error handling when (re)starting children. However a child starting and then immediately terminating without errors (which is a valid use case) would be treated as an error fix the problem by handling the not_alive error reason in syn.join()
1 parent 54ee2e9 commit fbfba35

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/syn_supervisor.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,9 @@ defmodule SynSupervisor do
944944
:ok ->
945945
{:reply, reply, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
946946

947+
{:error, :not_alive} ->
948+
{:reply, reply, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
949+
947950
{:error, reason} ->
948951
Process.exit(pid, :kill)
949952
{:reply, {:error, {:child_join_failed, reason}}, state}
@@ -954,6 +957,9 @@ defmodule SynSupervisor do
954957
:ok ->
955958
{:reply, reply, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
956959

960+
{:error, :not_alive} ->
961+
{:reply, reply, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
962+
957963
{:error, reason} ->
958964
Process.exit(pid, :kill)
959965
{:reply, {:error, {:child_join_failed, reason}}, state}
@@ -1398,6 +1404,10 @@ defmodule SynSupervisor do
13981404
state = delete_child(current_pid, state)
13991405
{:ok, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
14001406

1407+
{:error, :not_alive} ->
1408+
state = delete_child(current_pid, state)
1409+
{:ok, save_child(pid, id, mfa, restart, shutdown, type, modules, state)}
1410+
14011411
{:error, reason} ->
14021412
Process.exit(pid, :kill)
14031413

0 commit comments

Comments
 (0)