summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Hood <0x6e6562@gmail.com>2008-11-24 01:14:38 +0000
committerBen Hood <0x6e6562@gmail.com>2008-11-24 01:14:38 +0000
commitdcce15f3debfa3d2cf71f1e113b7c82fbf5ac624 (patch)
tree2f0449009af6167485fd1d4aa39a789d0f960de9 /src
parent3f3c7c842875a3865e2b6344590764558b57babb (diff)
downloadrabbitmq-server-git-dcce15f3debfa3d2cf71f1e113b7c82fbf5ac624.tar.gz
Differentiate between acks for basic.get and basic.consume
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_channel.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 4abc3494f3..f9f929598f 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};