fix(emqx_autn_api): wo do not need fixpoint
This commit is contained in:
parent
7165fbc5ca
commit
8af7131a49
|
@ -224,3 +224,4 @@ error_type_two_maps(M1, M2) when is_map(M1) ->
|
|||
{badmap, M2};
|
||||
error_type_two_maps(M1, _M2) ->
|
||||
{badmap, M1}.
|
||||
|
||||
|
|
|
@ -820,13 +820,10 @@ aggregate_status(AllStatus) ->
|
|||
aggregate_metrics([]) -> error_some_strange_happen;
|
||||
aggregate_metrics([HeadMetrics | AllMetrics]) ->
|
||||
CombinerFun =
|
||||
%% use fixpoint reference self
|
||||
fun (FixVal) ->
|
||||
fun (_, Val1, Val2) ->
|
||||
case erlang:is_map(Val1) of
|
||||
true -> emqx_map_lib:merge_with(FixVal(FixVal), Val1, Val2);
|
||||
false -> Val1 + Val2
|
||||
end
|
||||
fun ComFun(Val1, Val2) ->
|
||||
case erlang:is_map(Val1) of
|
||||
true -> emqx_map_lib:merge_with(ComFun, Val1, Val2);
|
||||
false -> Val1 + Val2
|
||||
end
|
||||
end,
|
||||
Fun = fun (ElemMap, AccMap) ->
|
||||
|
|
|
@ -35,3 +35,4 @@ introduced_in() ->
|
|||
emqx_rpc:erpc_multicall().
|
||||
lookup_from_all_nodes(Nodes, ChainName, AuthenticatorID) ->
|
||||
erpc:multicall(Nodes, emqx_authn_api, lookup_from_local_node, [ChainName, AuthenticatorID], ?TIMEOUT).
|
||||
|
||||
|
|
|
@ -169,16 +169,13 @@ test_authenticator(PathPrefix) ->
|
|||
uri(PathPrefix ++ [?CONF_NS, "password-based:http"])),
|
||||
{ok, RList} = emqx_json:safe_decode(Res),
|
||||
Snd = fun ({_, Val}) -> Val end,
|
||||
LookupVal =
|
||||
fun(FixVal) ->
|
||||
fun(List, RestJson) ->
|
||||
case List of
|
||||
[Name] -> Snd(lists:keyfind(Name, 1, RestJson));
|
||||
[Name | NS] -> (FixVal(FixVal))(NS, Snd(lists:keyfind(Name, 1, RestJson)))
|
||||
end
|
||||
LookupVal = fun LookupV(List, RestJson) ->
|
||||
case List of
|
||||
[Name] -> Snd(lists:keyfind(Name, 1, RestJson));
|
||||
[Name | NS] -> LookupV(NS, Snd(lists:keyfind(Name, 1, RestJson)))
|
||||
end
|
||||
end,
|
||||
LookFun = fun (List) -> (LookupVal(LookupVal))(List, RList) end,
|
||||
LookFun = fun (List) -> LookupVal(List, RList) end,
|
||||
MetricsList = [{<<"failed">>, 0},
|
||||
{<<"matched">>, 0},
|
||||
{<<"rate">>, 0.0},
|
||||
|
|
Loading…
Reference in New Issue