summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-01-13 02:43:15 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2011-01-13 02:43:15 +0000
commit00dbba335e855f53dd60fcd97582f13486c6a963 (patch)
treef34c17d416d8772d23b96bba086652e6ef719f9d
parent6a7d5447868f45d56fd31a1098a69ab5e891bd4e (diff)
downloadrabbitmq-server-00dbba335e855f53dd60fcd97582f13486c6a963.tar.gz
generalise optimisation
there is never any point in trying to send a multi-ack when there is just one message to confirm
-rw-r--r--src/rabbit_channel.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index c5e523ec..5badfb05 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -1208,15 +1208,12 @@ is_message_persistent(Content) ->
process_routing_result(unroutable, _, MsgSeqNo, Message, State) ->
ok = basic_return(Message, State#ch.writer_pid, no_route),
- ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
- State;
+ send_confirms([MsgSeqNo], State);
process_routing_result(not_delivered, _, MsgSeqNo, Message, State) ->
ok = basic_return(Message, State#ch.writer_pid, no_consumers),
- ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
- State;
+ send_confirms([MsgSeqNo], State);
process_routing_result(routed, [], MsgSeqNo, _, State) ->
- ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
- State;
+ send_confirms([MsgSeqNo], State);
process_routing_result(routed, _, undefined, _, State) ->
State;
process_routing_result(routed, QPids, MsgSeqNo, _, State) ->
@@ -1232,6 +1229,9 @@ lock_message(false, _MsgStruct, State) ->
send_confirms([], State) ->
State;
+send_confirms([MsgSeqNo], State = #ch{writer_pid = WriterPid}) ->
+ send_confirm(MsgSeqNo, WriterPid),
+ State;
send_confirms(Cs, State = #ch{writer_pid = WriterPid, unconfirmed = UC}) ->
SCs = lists:usort(Cs),
CutOff = case gb_sets:is_empty(UC) of