Skip to content

Commit 8ecca24

Browse files
author
Tim Watson
committed
merge bug25546 into stable
2 parents 7b22cb6 + 355ee7d commit 8ecca24

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/rabbit_channel.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ handle_method(#'basic.qos'{prefetch_count = 0}, _,
841841

842842
handle_method(#'basic.qos'{prefetch_count = PrefetchCount}, _,
843843
State = #ch{limiter = Limiter, unacked_message_q = UAMQ}) ->
844+
%% TODO queue:len(UAMQ) is not strictly right since that counts
845+
%% unacked messages from basic.get too. Pretty obscure though.
844846
Limiter1 = rabbit_limiter:limit_prefetch(Limiter,
845847
PrefetchCount, queue:len(UAMQ)),
846848
{reply, #'basic.qos_ok'{},

src/rabbit_limiter.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ prioritise_call(_Msg, _From, _Len, _State) -> 0.
324324
handle_call({new, ChPid}, _From, State = #lim{ch_pid = undefined}) ->
325325
{reply, ok, State#lim{ch_pid = ChPid}};
326326

327-
handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From, State) ->
328-
%% assertion
329-
true = State#lim.prefetch_count == 0 orelse
330-
State#lim.volume == UnackedCount,
327+
handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From,
328+
State = #lim{prefetch_count = 0}) ->
331329
{reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount,
332330
volume = UnackedCount})};
331+
handle_call({limit_prefetch, PrefetchCount, _UnackedCount}, _From, State) ->
332+
{reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount})};
333333

334334
handle_call(unlimit_prefetch, _From, State) ->
335335
{reply, ok, maybe_notify(State, State#lim{prefetch_count = 0,

0 commit comments

Comments
 (0)