diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2014-02-03 15:26:43 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2014-02-03 15:26:43 +0000 |
| commit | b6f050c9f573b24dc65d8e8ca9cbfdcb719a23e0 (patch) | |
| tree | b556893c9e93c7f75bb585478c18d02a3627f73e | |
| parent | aa81f3531d6e7d65809d7369adbec57aab490dae (diff) | |
| download | rabbitmq-server-git-b6f050c9f573b24dc65d8e8ca9cbfdcb719a23e0.tar.gz | |
optimisation
| -rw-r--r-- | src/rabbit_variable_queue.erl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index 020b5b3381..9d2423161d 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -643,6 +643,31 @@ drop(AckRequired, State) -> ack([], State) -> {[], State}; +%% optimisation: this head is essentially a partial evaluation of the +%% general case below, for the single-ack case. +ack([SeqId], State) -> + {#msg_status { msg_id = MsgId, + is_persistent = IsPersistent, + msg_on_disk = MsgOnDisk, + index_on_disk = IndexOnDisk }, + State1 = #vqstate { index_state = IndexState, + msg_store_clients = MSCState, + persistent_count = PCount, + ack_out_counter = AckOutCount }} = + remove_pending_ack(SeqId, State), + IndexState1 = case IndexOnDisk of + true -> rabbit_queue_index:ack([SeqId], IndexState); + false -> IndexState + end, + case MsgOnDisk of + true -> ok = msg_store_remove(MSCState, IsPersistent, [MsgId]); + false -> ok + end, + PCount1 = PCount - one_if(IsPersistent), + {[MsgId], + a(State1 #vqstate { index_state = IndexState1, + persistent_count = PCount1, + ack_out_counter = AckOutCount + 1 })}; ack(AckTags, State) -> {{IndexOnDiskSeqIds, MsgIdsByStore, AllMsgIds}, State1 = #vqstate { index_state = IndexState, |
