refactor(bridge): avoid unnecessary `maps:to_list/1` when listing
This commit is contained in:
parent
686bf8255b
commit
53bc27e0f4
|
@ -226,21 +226,21 @@ post_config_update(_, _Req, NewConf, OldConf, _AppEnv) ->
|
||||||
Result.
|
Result.
|
||||||
|
|
||||||
list() ->
|
list() ->
|
||||||
lists:foldl(
|
maps:fold(
|
||||||
fun({Type, NameAndConf}, Bridges) ->
|
fun(Type, NameAndConf, Bridges) ->
|
||||||
lists:foldl(
|
maps:fold(
|
||||||
fun({Name, RawConf}, Acc) ->
|
fun(Name, RawConf, Acc) ->
|
||||||
case lookup(Type, Name, RawConf) of
|
case lookup(Type, Name, RawConf) of
|
||||||
{error, not_found} -> Acc;
|
{error, not_found} -> Acc;
|
||||||
{ok, Res} -> [Res | Acc]
|
{ok, Res} -> [Res | Acc]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Bridges,
|
Bridges,
|
||||||
maps:to_list(NameAndConf)
|
NameAndConf
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
[],
|
[],
|
||||||
maps:to_list(emqx:get_raw_config([bridges], #{}))
|
emqx:get_raw_config([bridges], #{})
|
||||||
).
|
).
|
||||||
|
|
||||||
lookup(Id) ->
|
lookup(Id) ->
|
||||||
|
|
Loading…
Reference in New Issue