diff options
| author | Tim Watson <tim@rabbitmq.com> | 2013-05-10 13:32:12 +0100 |
|---|---|---|
| committer | Tim Watson <tim@rabbitmq.com> | 2013-05-10 13:32:12 +0100 |
| commit | e9a332345c910e3d0f0a8852d5d4cc71adf35b54 (patch) | |
| tree | 63013f2858b8c511ea871f69ea4cab00321d05c3 /src | |
| parent | 70d5d5db9eae985c9d4a1afee5c4b347832cbe58 (diff) | |
| parent | 355ee7dec9b7586ed37efc1a6328d10890da975f (diff) | |
| download | rabbitmq-server-git-e9a332345c910e3d0f0a8852d5d4cc71adf35b54.tar.gz | |
merge bug25546 into default
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_limiter.erl | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 52c6140e2c..37041d346e 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -841,6 +841,8 @@ handle_method(#'basic.qos'{prefetch_count = 0}, _, handle_method(#'basic.qos'{prefetch_count = PrefetchCount}, _, State = #ch{limiter = Limiter, unacked_message_q = UAMQ}) -> + %% TODO queue:len(UAMQ) is not strictly right since that counts + %% unacked messages from basic.get too. Pretty obscure though. Limiter1 = rabbit_limiter:limit_prefetch(Limiter, PrefetchCount, queue:len(UAMQ)), {reply, #'basic.qos_ok'{}, diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index d9f1170e76..1e32f95a3d 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -324,12 +324,12 @@ prioritise_call(_Msg, _From, _Len, _State) -> 0. handle_call({new, ChPid}, _From, State = #lim{ch_pid = undefined}) -> {reply, ok, State#lim{ch_pid = ChPid}}; -handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From, State) -> - %% assertion - true = State#lim.prefetch_count == 0 orelse - State#lim.volume == UnackedCount, +handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From, + State = #lim{prefetch_count = 0}) -> {reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount, volume = UnackedCount})}; +handle_call({limit_prefetch, PrefetchCount, _UnackedCount}, _From, State) -> + {reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount})}; handle_call(unlimit_prefetch, _From, State) -> {reply, ok, maybe_notify(State, State#lim{prefetch_count = 0, |
