We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7b22cb6 + 355ee7d commit 8ecca24Copy full SHA for 8ecca24
src/rabbit_channel.erl
@@ -841,6 +841,8 @@ handle_method(#'basic.qos'{prefetch_count = 0}, _,
841
842
handle_method(#'basic.qos'{prefetch_count = PrefetchCount}, _,
843
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.
846
Limiter1 = rabbit_limiter:limit_prefetch(Limiter,
847
PrefetchCount, queue:len(UAMQ)),
848
{reply, #'basic.qos_ok'{},
src/rabbit_limiter.erl
@@ -324,12 +324,12 @@ prioritise_call(_Msg, _From, _Len, _State) -> 0.
324
handle_call({new, ChPid}, _From, State = #lim{ch_pid = undefined}) ->
325
{reply, ok, State#lim{ch_pid = ChPid}};
326
327
-handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From, State) ->
328
- %% assertion
329
- true = State#lim.prefetch_count == 0 orelse
330
- State#lim.volume == UnackedCount,
+handle_call({limit_prefetch, PrefetchCount, UnackedCount}, _From,
+ State = #lim{prefetch_count = 0}) ->
331
{reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount,
332
volume = UnackedCount})};
+handle_call({limit_prefetch, PrefetchCount, _UnackedCount}, _From, State) ->
+ {reply, ok, maybe_notify(State, State#lim{prefetch_count = PrefetchCount})};
333
334
handle_call(unlimit_prefetch, _From, State) ->
335
{reply, ok, maybe_notify(State, State#lim{prefetch_count = 0,
0 commit comments