Skip to content

Commit 8254b8f

Browse files
author
Matthias Radestock
committed
cosmetic
1 parent a05bed3 commit 8254b8f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/rabbit_limiter.erl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ can_send(undefined, _QPid, _AckRequired) ->
9090
can_send(LimiterPid, QPid, AckRequired) ->
9191
rabbit_misc:with_exit_handler(
9292
fun () -> true end,
93-
fun () -> gen_server2:call(LimiterPid, {can_send, QPid, AckRequired}, infinity) end).
93+
fun () -> gen_server2:call(LimiterPid, {can_send, QPid, AckRequired},
94+
infinity) end).
9495

9596
%% Let the limiter know that the channel has received some acks from a
9697
%% consumer
@@ -110,13 +111,13 @@ unregister(LimiterPid, QPid) -> gen_server2:cast(LimiterPid, {unregister, QPid})
110111
init([ChPid]) ->
111112
{ok, #lim{ch_pid = ChPid} }.
112113

113-
handle_call({can_send, QPid, AckRequired}, _From, State = #lim{volume = Volume}) ->
114-
Volume1 = if AckRequired -> Volume + 1;
115-
true -> Volume
116-
end,
114+
handle_call({can_send, QPid, AckRequired}, _From,
115+
State = #lim{volume = Volume}) ->
117116
case limit_reached(State) of
118117
true -> {reply, false, limit_queue(QPid, State)};
119-
false -> {reply, true, State#lim{volume = Volume1}}
118+
false -> {reply, true, State#lim{volume = if AckRequired -> Volume + 1;
119+
true -> Volume
120+
end}}
120121
end.
121122

122123
handle_cast(shutdown, State) ->

0 commit comments

Comments
 (0)