diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-01-25 12:43:15 +0000 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-01-25 12:43:15 +0000 |
commit | 46e5a9fb699c37c662824e947c402d0e62a38947 (patch) | |
tree | 7a111e62dd1e2c5f3a41996a9d015817e91799c3 | |
parent | 8966131b683b125eabb3442ed69f1bd8000f6224 (diff) | |
download | rabbitmq-server-46e5a9fb699c37c662824e947c402d0e62a38947.tar.gz |
reject doesn't need to know about the channel state.
-rw-r--r-- | src/rabbit_channel.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index e03be3a0..6625ce45 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -1073,11 +1073,12 @@ handle_method(#'tx.commit'{}, _, #ch{tx_status = none}) -> handle_method(#'tx.commit'{}, _, State = #ch{uncommitted_message_q = TMQ, uncommitted_acks = TAL, - uncommitted_nacks = TNL}) -> + uncommitted_nacks = TNL, + limiter = Limiter}) -> State1 = rabbit_misc:queue_fold(fun deliver_to_queues/2, State, TMQ), State2 = ack(TAL, State1), State3 = lists:foldl( - fun ({Requeue, Acked}, S) -> reject(Requeue, Acked, S) end, + fun ({Requeue, Acked}, S) -> reject(Requeue, Acked, Limiter) end, State2, TNL), State4 = new_tx(State3), {noreply, maybe_complete_tx(State4#ch{tx_status = committing})}; @@ -1282,19 +1283,19 @@ reject_tx(DeliveryTag, Multiple, Requeue, State1 = State#ch{unacked_message_q = Remaining}, {noreply, case TxStatus of - none -> reject(Requeue, Acked, State1), + none -> reject(Requeue, Acked, State1#ch.limiter), State1; in_progress -> State1#ch{uncommitted_nacks = {Requeue, Acked} ++ State1#ch.uncommitted_nacks} end}. -reject(Requeue, Acked, State) -> +reject(Requeue, Acked, Limiter) -> ok = fold_per_queue( fun (QPid, MsgIds, ok) -> rabbit_amqqueue:reject(QPid, MsgIds, Requeue, self()) end, ok, Acked), - ok = notify_limiter(State#ch.limiter, Acked). + ok = notify_limiter(Limiter, Acked). ack_record(DeliveryTag, ConsumerTag, _MsgStruct = {_QName, QPid, MsgId, _Redelivered, _Msg}) -> |