diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2015-05-11 14:02:28 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2015-05-11 14:02:28 +0300 |
| commit | 3f08241f866c01011170439b5f042f672e6f3b1a (patch) | |
| tree | 04dccd79adabd12a6d189748151215b955224267 | |
| parent | 54c63a2eeaccdd36381d12283e244e7133c6ab27 (diff) | |
| download | rabbitmq-server-git-3f08241f866c01011170439b5f042f672e6f3b1a.tar.gz | |
Re-format with Emacs
| -rw-r--r-- | src/rabbit_dead_letter.erl | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/rabbit_dead_letter.erl b/src/rabbit_dead_letter.erl index 050e661b5a..2e6e024ce7 100644 --- a/src/rabbit_dead_letter.erl +++ b/src/rabbit_dead_letter.erl @@ -99,19 +99,19 @@ group_by_queue_and_reason([Table]) -> 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), - Matcher = queue_and_reason_matcher(Q, R), - {Matches, _} = lists:partition(Matcher, Tables), - {Augmented, N} = case Matches of - [X] -> {X, 1}; - [X|_] = Xs -> {X, length(Xs)} - end, - Key = {Q, R}, - Acc1 = maybe_append_to_event_group( - ensure_xdeath_event_count(Augmented, N), Key, SeenKeys, Acc), - {sets:add_element(Key, SeenKeys), Acc1} - end, {sets:new(), []}, Tables), + Q = x_death_event_key(Info, <<"queue">>, longstr), + R = x_death_event_key(Info, <<"reason">>, longstr), + Matcher = queue_and_reason_matcher(Q, R), + {Matches, _} = lists:partition(Matcher, Tables), + {Augmented, N} = case Matches of + [X] -> {X, 1}; + [X|_] = Xs -> {X, length(Xs)} + end, + Key = {Q, R}, + Acc1 = maybe_append_to_event_group( + ensure_xdeath_event_count(Augmented, N), Key, SeenKeys, Acc), + {sets:add_element(Key, SeenKeys), Acc1} + end, {sets:new(), []}, Tables), Grouped. update_x_death_header(Info, Headers) -> @@ -120,13 +120,13 @@ update_x_death_header(Info, Headers) -> case rabbit_basic:header(<<"x-death">>, Headers) of undefined -> rabbit_basic:prepend_table_header(<<"x-death">>, - [{<<"count">>, long, 1} | Info], Headers); + [{<<"count">>, long, 1} | Info], Headers); {<<"x-death">>, array, Tables} -> %% group existing x-death headers in case we have some from %% before rabbitmq-server#78 GroupedTables = group_by_queue_and_reason(Tables), {Matches, Others} = lists:partition( - queue_and_reason_matcher(Q, R), GroupedTables), + queue_and_reason_matcher(Q, R), GroupedTables), Info1 = case Matches of [] -> [{<<"count">>, long, 1} | Info]; @@ -134,7 +134,7 @@ update_x_death_header(Info, Headers) -> increment_xdeath_event_count(M) end, rabbit_misc:set_table_value(Headers, <<"x-death">>, array, - [{table, rabbit_misc:sort_field_table(Info1)} | Others]) + [{table, rabbit_misc:sort_field_table(Info1)} | Others]) end. ensure_xdeath_event_count({table, Info}, InitialVal) when InitialVal >= 1 -> @@ -153,20 +153,20 @@ increment_xdeath_event_count(Info) -> [{<<"count">>, long, 1} | Info]; N -> lists:keyreplace( - <<"count">>, 1, Info, - {<<"count">>, long, N + 1}) + <<"count">>, 1, Info, + {<<"count">>, long, N + 1}) end. 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 - end, - fun({table, Info}) -> - F(Info); - (Info) when is_list(Info) -> - F(Info) - end. + F = fun(Info) -> + x_death_event_key(Info, <<"queue">>, longstr) =:= Q + andalso x_death_event_key(Info, <<"reason">>, longstr) =:= R + end, + fun({table, Info}) -> + F(Info); + (Info) when is_list(Info) -> + F(Info) + end. per_msg_ttl_header(#'P_basic'{expiration = undefined}) -> []; |
