Don't register listeners that failed to start in config reload

This should alleviate some issues in #3850
This commit is contained in:
Paweł Chmielowski 2022-06-21 11:09:37 +02:00
parent 46c947bc76
commit 06147deccd
1 changed files with 12 additions and 4 deletions

View File

@ -457,11 +457,19 @@ config_reloaded() ->
ok; ok;
{_, OldModule, OldOpts} -> {_, OldModule, OldOpts} ->
_ = stop_listener(EndPoint, OldModule, OldOpts), _ = stop_listener(EndPoint, OldModule, OldOpts),
ets:insert(?MODULE, {EndPoint, Module, Opts}), case start_listener(EndPoint, Module, Opts) of
start_listener(EndPoint, Module, Opts); {ok, _} ->
ets:insert(?MODULE, {EndPoint, Module, Opts});
_ ->
ok
end;
false -> false ->
ets:insert(?MODULE, {EndPoint, Module, Opts}), case start_listener(EndPoint, Module, Opts) of
start_listener(EndPoint, Module, Opts) {ok, _} ->
ets:insert(?MODULE, {EndPoint, Module, Opts});
_ ->
ok
end
end end
end, New). end, New).