fix(gw): fix list listeners failed if gateway disabled

This commit is contained in:
JianBo He 2022-06-13 17:43:06 +08:00
parent 14a26fc876
commit 6c465cfb8f
2 changed files with 11 additions and 4 deletions

View File

@ -292,7 +292,14 @@ do_listeners_cluster_status(Listeners) ->
fun({Id, ListenOn}, Acc) -> fun({Id, ListenOn}, Acc) ->
BinId = erlang:atom_to_binary(Id), BinId = erlang:atom_to_binary(Id),
{ok, #{<<"max_connections">> := Max}} = emqx_gateway_conf:listener(BinId), {ok, #{<<"max_connections">> := Max}} = emqx_gateway_conf:listener(BinId),
Curr = esockd:get_current_connections({Id, ListenOn}), Curr =
try esockd:get_current_connections({Id, ListenOn}) of
Int -> Int
catch
%% not started
error:not_found ->
0
end,
Acc#{ Acc#{
Id => #{ Id => #{
node => Node, node => Node,

View File

@ -173,14 +173,14 @@ handle_info(
) -> ) ->
case lists:member(Pid, Pids) of case lists:member(Pid, Pids) of
true -> true ->
?SLOG(error, #{ ?SLOG(info, #{
msg => "child_process_exited", msg => "child_process_exited",
child => Pid, child => Pid,
reason => Reason reason => Reason
}), }),
case Pids -- [Pid] of case Pids -- [Pid] of
[] -> [] ->
?SLOG(error, #{ ?SLOG(info, #{
msg => "gateway_all_children_process_existed", msg => "gateway_all_children_process_existed",
gateway_name => Name gateway_name => Name
}), }),
@ -193,7 +193,7 @@ handle_info(
{noreply, State#state{child_pids = RemainPids}} {noreply, State#state{child_pids = RemainPids}}
end; end;
_ -> _ ->
?SLOG(error, #{ ?SLOG(info, #{
msg => "gateway_catch_a_unknown_process_exited", msg => "gateway_catch_a_unknown_process_exited",
child => Pid, child => Pid,
reason => Reason, reason => Reason,