summaryrefslogtreecommitdiff
path: root/src/rabbit_amqqueue_process.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-01-10 20:44:36 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2011-01-10 20:44:36 +0000
commit22d129f63132032fa014ba78ca149b1b0b6106c7 (patch)
tree6fd41089b040fdf490b61c96982141f94198077f /src/rabbit_amqqueue_process.erl
parentceba1d4c1a442e7914b8935358ff904111870f72 (diff)
downloadrabbitmq-server-22d129f63132032fa014ba78ca149b1b0b6106c7.tar.gz
small simplifying refactorbug23593
Diffstat (limited to 'src/rabbit_amqqueue_process.erl')
-rw-r--r--src/rabbit_amqqueue_process.erl31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index f2affd9f..fde54346 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -425,27 +425,26 @@ deliver_from_queue_deliver(AckRequired, false, State) ->
fetch(AckRequired, State),
{{Message, IsDelivered, AckTag}, 0 == Remaining, State1}.
-confirm_messages(Guids, State) ->
- {CMs, State1} =
- lists:foldl(fun(Guid, {CMs, State0 = #q{guid_to_channel = GTC0}}) ->
- case dict:find(Guid, GTC0) of
- {ok, {ChPid, MsgSeqNo}} ->
- {[{ChPid, MsgSeqNo} | CMs],
- State0#q{guid_to_channel =
- dict:erase(Guid, GTC0)}};
- _ ->
- {CMs, State0}
- end
- end, {[], State}, Guids),
+confirm_messages(Guids, State = #q{guid_to_channel = GTC}) ->
+ {CMs, GTC1} =
+ lists:foldl(
+ fun(Guid, {CMs, GTC0}) ->
+ case dict:find(Guid, GTC0) of
+ {ok, {ChPid, MsgSeqNo}} ->
+ {[{ChPid, MsgSeqNo} | CMs], dict:erase(Guid, GTC0)};
+ _ ->
+ {CMs, GTC0}
+ end
+ end, {[], GTC}, Guids),
case lists:usort(CMs) of
[{Ch, MsgSeqNo} | CMs1] ->
- CMs2 = group_confirms_by_channel(CMs1, [{Ch, [MsgSeqNo]}]),
- [rabbit_channel:confirm(ChPid, MsgSeqNos)
- || {ChPid, MsgSeqNos} <- CMs2];
+ [rabbit_channel:confirm(ChPid, MsgSeqNos) ||
+ {ChPid, MsgSeqNos} <- group_confirms_by_channel(
+ CMs1, [{Ch, [MsgSeqNo]}])];
[] ->
ok
end,
- State1.
+ State#q{guid_to_channel = GTC1}.
group_confirms_by_channel([], Acc) ->
Acc;