mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix race condition in Redis/SQL supervisors startup
This commit is contained in:
parent
86c4f76c51
commit
72f6835feb
@ -45,7 +45,10 @@ start() ->
|
||||
permanent, infinity, supervisor, [?MODULE]},
|
||||
case supervisor:start_child(ejabberd_db_sup, Spec) of
|
||||
{ok, _} -> ok;
|
||||
{error, {already_started, _}} -> ok;
|
||||
{error, {already_started, Pid}} ->
|
||||
%% Wait for the supervisor to fully start
|
||||
_ = supervisor:count_children(Pid),
|
||||
ok;
|
||||
{error, Why} = Err ->
|
||||
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
||||
Err
|
||||
|
@ -52,7 +52,10 @@ start(Host) ->
|
||||
modules => [?MODULE]},
|
||||
case supervisor:start_child(ejabberd_db_sup, Spec) of
|
||||
{ok, _} -> ok;
|
||||
{error, {already_started, _}} -> ok;
|
||||
{error, {already_started, Pid}} ->
|
||||
%% Wait for the supervisor to fully start
|
||||
_ = supervisor:count_children(Pid),
|
||||
ok;
|
||||
{error, Why} = Err ->
|
||||
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
||||
Err
|
||||
|
Loading…
Reference in New Issue
Block a user