Skip to content

Commit 4e60556

Browse files
author
Simon MacMullen
committed
Remove assertion; it's not always correct if prefetch has been set before. Instead, only set the volume when we have not set prefetch before.
1 parent 3c717c4 commit 4e60556

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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)