fix(emqx_management): Ignore results from the nodes that are down
This commit is contained in:
parent
37c0badb06
commit
a947df1ea3
|
@ -127,10 +127,19 @@ list(get, #{query_string := Qs}) ->
|
|||
true ->
|
||||
{200, emqx_mgmt:get_stats()};
|
||||
_ ->
|
||||
Data = [
|
||||
maps:from_list(emqx_mgmt:get_stats(Node) ++ [{node, Node}])
|
||||
|| Node <- running_nodes()
|
||||
],
|
||||
Data = lists:foldl(
|
||||
fun(Node, Acc) ->
|
||||
case emqx_mgmt:get_stats(Node) of
|
||||
{error, _Err} ->
|
||||
Acc;
|
||||
Stats when is_list(Stats) ->
|
||||
Data = maps:from_list([{node, Node} | Stats]),
|
||||
[Data | Acc]
|
||||
end
|
||||
end,
|
||||
[],
|
||||
mria:running_nodes()
|
||||
),
|
||||
{200, Data}
|
||||
end.
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Fix error `/api/v5/monitor_current` API endpoint when some EMQX nodes are down.
|
||||
|
||||
Prior to this fix, sometimes the request returned HTTP code 500 and the following message:
|
||||
```
|
||||
{"code":"INTERNAL_ERROR","message":"error, badarg, [{erlang,'++',[{error,nodedown},[{node,'emqx@10.42.0.150'}]], ...
|
||||
```
|
Loading…
Reference in New Issue