diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2010-06-14 09:46:00 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-06-14 09:46:00 +0100 |
| commit | ccca12049ade4f11602ec71a30459e315f4b15ab (patch) | |
| tree | 20f7521870dd91c25b1f2f8fb1b53414f7cc0ade | |
| parent | 0a53cb9c40c220fd173a100e99b763ce1cd2cf8d (diff) | |
| download | rabbitmq-server-git-ccca12049ade4f11602ec71a30459e315f4b15ab.tar.gz | |
minor refactor
| -rw-r--r-- | src/rabbit_variable_queue.erl | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index dfea10542c..32c5176485 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -925,23 +925,21 @@ tx_commit_index(State = #vqstate { on_sync = {_, _, []} }) -> tx_commit_index(State = #vqstate { on_sync = {SAcks, SPubs, SFuns}, durable = IsDurable }) -> Acks = lists:flatten(SAcks), - State1 = ack(Acks, State), Pubs = lists:flatten(lists:reverse(SPubs)), - {SeqIds, State2 = #vqstate { index_state = IndexState }} = + {SeqIds, State1 = #vqstate { index_state = IndexState }} = lists:foldl( fun (Msg = #basic_message { is_persistent = IsPersistent }, - {SeqIdsAcc, StateN}) -> - {SeqId, StateN1} = - publish(Msg, false, IsDurable andalso IsPersistent, - StateN), - {case IsDurable andalso IsPersistent of + {SeqIdsAcc, State2}) -> + IsPersistent1 = IsDurable andalso IsPersistent, + {SeqId, State3} = publish(Msg, false, IsPersistent1, State2), + {case IsPersistent1 of true -> [SeqId | SeqIdsAcc]; false -> SeqIdsAcc - end, StateN1} - end, {Acks, State1}, Pubs), + end, State3} + end, {Acks, ack(Acks, State)}, Pubs), IndexState1 = rabbit_queue_index:sync(SeqIds, IndexState), [ Fun() || Fun <- lists:reverse(SFuns) ], - State2 #vqstate { index_state = IndexState1, on_sync = {[], [], []} }. + State1 #vqstate { index_state = IndexState1, on_sync = {[], [], []} }. delete1(_TransientThreshold, NextSeqId, DeltaSeqId, IndexState) when DeltaSeqId =:= undefined orelse DeltaSeqId >= NextSeqId -> |
