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
commita2c69d87b0825cc2ccbab00852c18c8426f1ba27 (patch)
tree79e4c8fbfa45829b71e6b3165e78ab52a1ae1a50
parent7f12ebe6bea5e2c996420870037e312a3a1cff2e (diff)
downloadrabbitmq-server-git-a2c69d87b0825cc2ccbab00852c18c8426f1ba27.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 35f0b8167b..d7cd9fb1c7 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}.