summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2020-02-19 13:32:13 +0300
committerMichael Klishin <michael@clojurewerkz.org>2020-02-19 13:32:13 +0300
commitd9318ab187ac7794ec1767bc4fed58ab316972de (patch)
treea21ede111e46132ce397429a5ff86fd69f6f349a
parent12571627a6089aa7d603e92b3e35745c8d398b3e (diff)
downloadrabbitmq-server-git-d9318ab187ac7794ec1767bc4fed58ab316972de.tar.gz
rabbit_definitions:concurrent_for_all/4: avoid an unintentional match
-rw-r--r--src/rabbit_definitions.erl13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/rabbit_definitions.erl b/src/rabbit_definitions.erl
index 14e991cac5..b9058f6588 100644
--- a/src/rabbit_definitions.erl
+++ b/src/rabbit_definitions.erl
@@ -308,8 +308,7 @@ sequential_for_all(Category, ActingUser, Definitions, Fun) ->
end,
[begin
%% keys are expected to be atoms
- Atomized = atomize_keys(M),
- Fun(Atomized, ActingUser)
+ Fun(atomize_keys(M), ActingUser)
end || M <- List, is_map(M)]
end.
@@ -317,9 +316,7 @@ sequential_for_all(Name, ActingUser, Definitions, VHost, Fun) ->
case maps:get(rabbit_data_coercion:to_atom(Name), Definitions, undefined) of
undefined -> ok;
- List -> [Fun(VHost, maps:from_list([{atomise_name(K), V} || {K, V} <- maps:to_list(M)]),
- ActingUser) ||
- M <- List, is_map(M)]
+ List -> [Fun(VHost, atomize_keys(M), ActingUser) || M <- List, is_map(M)]
end.
concurrent_for_all(Category, ActingUser, Definitions, Fun) ->
@@ -333,12 +330,11 @@ concurrent_for_all(Category, ActingUser, Definitions, Fun) ->
{ok, Gatherer} = gatherer:start_link(),
[begin
%% keys are expected to be atoms
- Atomized = atomize_keys(M),
ok = gatherer:fork(Gatherer),
worker_pool:submit_async(
?IMPORT_WORK_POOL,
fun() ->
- Fun(Atomized, ActingUser),
+ Fun(atomize_keys(M), ActingUser),
gatherer:finish(Gatherer)
end)
end || M <- List, is_map(M)],
@@ -353,12 +349,11 @@ concurrent_for_all(Name, ActingUser, Definitions, VHost, Fun) ->
{ok, Gatherer} = gatherer:start_link(),
[begin
%% keys are expected to be atoms
- Atomized = M = atomize_keys(M),
ok = gatherer:fork(Gatherer),
worker_pool:submit_async(
?IMPORT_WORK_POOL,
fun() ->
- Fun(VHost, Atomized, ActingUser),
+ Fun(VHost, atomize_keys(M), ActingUser),
gatherer:finish(Gatherer)
end)
end || M <- List, is_map(M)],