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