diff options
author | Ben Hood <0x6e6562@gmail.com> | 2008-11-24 01:14:38 +0000 |
---|---|---|
committer | Ben Hood <0x6e6562@gmail.com> | 2008-11-24 01:14:38 +0000 |
commit | c4f8ddb5cb914b0f825a5c8fc30df594f92c8703 (patch) | |
tree | 2f0449009af6167485fd1d4aa39a789d0f960de9 | |
parent | 1b8c0ff6a1f6a305945afacdb3e5d223ae1221f9 (diff) | |
download | rabbitmq-server-c4f8ddb5cb914b0f825a5c8fc30df594f92c8703.tar.gz |
Differentiate between acks for basic.get and basic.consume
-rw-r--r-- | src/rabbit_channel.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 4abc3494..f9f92959 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -281,7 +281,19 @@ handle_method(#'basic.ack'{delivery_tag = DeliveryTag, end, {Acked, Remaining} = collect_acks(UAMQ, DeliveryTag, Multiple), % CC the limiter on the number of acks that have been received - rabbit_limiter:decrement_capacity(Limiter, queue:len(Acked)), + % but don't include any acks from a basic.get bottom half + % (hence the differentiation between tags set to none and other tags) + % TODO - this is quite crude and is probably more expensive than it should + % be - according to the OTP documentation, len/1 runs in O(n), probably + % not so cool for a queuing system + NotBasicGet = queue:filter( + fun({_CurrentDeliveryTag, ConsumerTag, _Msg}) -> + case ConsumerTag of + none -> false; + _ -> true + end + end, Acked), + rabbit_limiter:decrement_capacity(Limiter, queue:len(NotBasicGet)), Participants = ack(State#ch.proxy_pid, TxnKey, Acked), {noreply, case TxnKey of none -> State#ch{unacked_message_q = Remaining}; |