diff options
author | Michael Klishin <michael@rabbitmq.com> | 2013-06-20 17:36:10 +0400 |
---|---|---|
committer | Michael Klishin <michael@rabbitmq.com> | 2013-06-20 17:36:10 +0400 |
commit | 18ec96b321e4bb9db0ec2535bd9607641d217f83 (patch) | |
tree | ed82a0fec6ae8ff40a7480414b9be5abf18a7f1c | |
parent | c51b1af576e759b11cf6a3f527397e8434f65aab (diff) | |
download | rabbitmq-server-18ec96b321e4bb9db0ec2535bd9607641d217f83.tar.gz |
Make sure the list of alarm resources is unique
-rw-r--r-- | src/rabbit_alarm.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index 93997a37..000c1e2a 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -142,6 +142,13 @@ code_change(_OldVsn, State, _Extra) -> %%---------------------------------------------------------------------------- +dict_append(Key, Val, Dict) -> + L = case dict:find(Key, Dict) of + {ok, V} -> V; + error -> [] + end, + dict:store(Key, lists:usort([Val|L]), Dict). + dict_unappend_all(Key, _Val, Dict) -> dict:erase(Key, Dict). @@ -220,7 +227,7 @@ handle_set_alarm({{resource_limit, Source, Node}, []}, State) -> "*** Publishers will be blocked until this alarm clears ***~n" "**********************************************************~n", [Source, Node]), - {ok, maybe_alert(fun dict:append/3, Node, Source, State)}; + {ok, maybe_alert(fun dict_append/3, Node, Source, State)}; handle_set_alarm({file_descriptor_limit, []}, State) -> rabbit_log:warning( "file descriptor limit alarm set.~n~n" |