summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-01-06 01:31:31 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2013-01-06 01:31:31 +0000
commit53d2a03f0f5dc5a442672292aa0e49f48ca5e560 (patch)
tree79e4c8fbfa45829b71e6b3165e78ab52a1ae1a50
parentf2474ad8809cd83b71741eef718138d2479b745e (diff)
downloadrabbitmq-server-53d2a03f0f5dc5a442672292aa0e49f48ca5e560.tar.gz
optimise "no confirms" case of rabbit_amqqueue_process:discard
-rw-r--r--src/rabbit_amqqueue_process.erl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 35f0b816..d7cd9fb1 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -498,11 +498,14 @@ send_or_record_confirm(#delivery{sender = SenderPid,
rabbit_misc:confirm_to_sender(SenderPid, [MsgSeqNo]),
{immediately, State}.
-discard(#delivery{sender = SenderPid, message = #basic_message{id = MsgId}},
- State) ->
- %% fake an 'eventual' confirm from BQ; noop if not needed
+discard(#delivery{sender = SenderPid,
+ msg_seq_no = MsgSeqNo,
+ message = #basic_message{id = MsgId}}, State) ->
State1 = #q{backing_queue = BQ, backing_queue_state = BQS} =
- confirm_messages([MsgId], State),
+ case MsgSeqNo of
+ undefined -> State;
+ _ -> confirm_messages([MsgId], State)
+ end,
BQS1 = BQ:discard(MsgId, SenderPid, BQS),
State1#q{backing_queue_state = BQS1}.