summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2015-07-08 14:38:11 +0300
committerMichael Klishin <michael@novemberain.com>2015-07-08 14:38:11 +0300
commita9615545545daf17c3d168deead29444c293b88a (patch)
tree3e91561b558ba2d2f07b8f17d4b809055e7fc8e3
parent632845bea39bce9a14ac78b8c382c060c4966cd7 (diff)
parent508d76d31984caf91977d2b0fdb095ed829981b3 (diff)
downloadrabbitmq-server-git-a9615545545daf17c3d168deead29444c293b88a.tar.gz
Merge pull request #221 from rabbitmq/rabbitmq-server-216rabbitmq_v3_5_4_rc1
Be less assertive about x-death value types, fixes #216
-rw-r--r--src/rabbit_dead_letter.erl22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/rabbit_dead_letter.erl b/src/rabbit_dead_letter.erl
index 35096bc2a2..29032df856 100644
--- a/src/rabbit_dead_letter.erl
+++ b/src/rabbit_dead_letter.erl
@@ -78,10 +78,10 @@ make_msg(Msg = #basic_message{content = Content,
content = Content2}.
-x_death_event_key(Info, Key, KeyType) ->
+x_death_event_key(Info, Key) ->
case lists:keysearch(Key, 1, Info) of
- false -> undefined;
- {value, {Key, KeyType, Val}} -> Val
+ false -> undefined;
+ {value, {Key, _KeyType, Val}} -> Val
end.
maybe_append_to_event_group(Table, _Key, _SeenKeys, []) ->
@@ -100,8 +100,8 @@ group_by_queue_and_reason(Tables) ->
{_, Grouped} =
lists:foldl(
fun ({table, Info}, {SeenKeys, Acc}) ->
- Q = x_death_event_key(Info, <<"queue">>, longstr),
- R = x_death_event_key(Info, <<"reason">>, longstr),
+ Q = x_death_event_key(Info, <<"queue">>),
+ R = x_death_event_key(Info, <<"reason">>),
Matcher = queue_and_reason_matcher(Q, R),
{Matches, _} = lists:partition(Matcher, Tables),
{Augmented, N} = case Matches of
@@ -117,8 +117,8 @@ group_by_queue_and_reason(Tables) ->
Grouped.
update_x_death_header(Info, Headers) ->
- Q = x_death_event_key(Info, <<"queue">>, longstr),
- R = x_death_event_key(Info, <<"reason">>, longstr),
+ Q = x_death_event_key(Info, <<"queue">>),
+ R = x_death_event_key(Info, <<"reason">>),
case rabbit_basic:header(<<"x-death">>, Headers) of
undefined ->
rabbit_basic:prepend_table_header(
@@ -145,7 +145,7 @@ update_x_death_header(Info, Headers) ->
ensure_xdeath_event_count({table, Info}, InitialVal) when InitialVal >= 1 ->
{table, ensure_xdeath_event_count(Info, InitialVal)};
ensure_xdeath_event_count(Info, InitialVal) when InitialVal >= 1 ->
- case x_death_event_key(Info, <<"count">>, long) of
+ case x_death_event_key(Info, <<"count">>) of
undefined ->
[{<<"count">>, long, InitialVal} | Info];
_ ->
@@ -153,7 +153,7 @@ ensure_xdeath_event_count(Info, InitialVal) when InitialVal >= 1 ->
end.
increment_xdeath_event_count(Info) ->
- case x_death_event_key(Info, <<"count">>, long) of
+ case x_death_event_key(Info, <<"count">>) of
undefined ->
[{<<"count">>, long, 1} | Info];
N ->
@@ -164,8 +164,8 @@ increment_xdeath_event_count(Info) ->
queue_and_reason_matcher(Q, R) ->
F = fun(Info) ->
- x_death_event_key(Info, <<"queue">>, longstr) =:= Q
- andalso x_death_event_key(Info, <<"reason">>, longstr) =:= R
+ x_death_event_key(Info, <<"queue">>) =:= Q
+ andalso x_death_event_key(Info, <<"reason">>) =:= R
end,
fun({table, Info}) ->
F(Info);