fix(api): query client subscriptions from cluster empty check

This commit is contained in:
DDDHuang 2022-01-25 10:53:21 +08:00
parent a3e3f2216c
commit 6b020b4a01
1 changed files with 8 additions and 4 deletions

View File

@ -269,10 +269,14 @@ list_authz_cache(ClientId) ->
list_client_subscriptions(ClientId) -> list_client_subscriptions(ClientId) ->
Results = [client_subscriptions(Node, ClientId) || Node <- mria_mnesia:running_nodes()], Results = [client_subscriptions(Node, ClientId) || Node <- mria_mnesia:running_nodes()],
Expected = lists:filter(fun({error, _}) -> false; Filter =
([]) -> false; fun
(_) -> true ({error, _}) ->
end, Results), false;
({_Node, List}) ->
erlang:is_list(List) andalso 0 < erlang:length(List)
end,
Expected = lists:filter(Filter, Results),
case Expected of case Expected of
[] -> []; [] -> [];
[Result | _] -> Result [Result | _] -> Result