diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-28 02:32:00 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-28 02:32:00 +0100 |
commit | 8048d47671ad46d13d2c081825cf66120e9158ac (patch) | |
tree | 87598c067e3aa3d8dce14c6a32c1bc95799718c2 | |
parent | ca1f41fc32f762db50d32b5602ad18a5c573cb9a (diff) | |
download | rabbitmq-server-bug23115.tar.gz |
minor tweaksbug23115
- rename rabbit_limiter:internal_is_blocked to 'blocked' - reads less
awkward that way
- call 'blocked' in handler of rabbit_limiter:is_blocked call - avoids
code dup and makes the connection to the internal check more obvious
- rename info item to 'client_flow_blocked'
- tweak docs for info item to hopefully make it clearer how the
condition arises and what the consequences are.
-rw-r--r-- | docs/rabbitmqctl.1.xml | 8 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 4 | ||||
-rw-r--r-- | src/rabbit_limiter.erl | 10 |
3 files changed, 13 insertions, 9 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index 57fb0827..7dc6c32e 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -1102,8 +1102,12 @@ <listitem><para>QoS prefetch count limit in force, 0 if unlimited.</para></listitem> </varlistentry> <varlistentry> - <term>blocked_channelflow</term> - <listitem><para>True if the consuming client blocked the channel, false otherwise.</para></listitem> + <term>client_flow_blocked</term> + <listitem><para>True if the client issued a + <command>channel.flow{active=false}</command> + command, blocking the server from delivering + messages to the channel's consumers. + </para></listitem> </varlistentry> </variablelist> <para> diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index b53511dd..fb3896bd 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -59,7 +59,7 @@ messages_unacknowledged, acks_uncommitted, prefetch_count, - blocked_channelflow]). + client_flow_blocked]). -define(CREATION_EVENT_KEYS, [pid, @@ -1126,7 +1126,7 @@ i(acks_uncommitted, #ch{uncommitted_ack_q = UAQ}) -> queue:len(UAQ); i(prefetch_count, #ch{limiter_pid = LimiterPid}) -> rabbit_limiter:get_limit(LimiterPid); -i(blocked_channelflow, #ch{limiter_pid = LimiterPid}) -> +i(client_flow_blocked, #ch{limiter_pid = LimiterPid}) -> rabbit_limiter:is_blocked(LimiterPid); i(Item, _) -> throw({bad_argument, Item}). diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index 177b0bb9..be1dcad1 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -165,8 +165,8 @@ handle_call(unblock, _From, State) -> {stop, State1} -> {stop, normal, stopped, State1} end; -handle_call(is_blocked, _From, State = #lim{blocked = Blocked}) -> - {reply, Blocked, State}. +handle_call(is_blocked, _From, State) -> + {reply, blocked(State), State}. handle_cast({ack, Count}, State = #lim{volume = Volume}) -> NewVolume = if Volume == 0 -> 0; @@ -195,8 +195,8 @@ code_change(_, State, _) -> %%---------------------------------------------------------------------------- maybe_notify(OldState, NewState) -> - case (limit_reached(OldState) orelse internal_is_blocked(OldState)) andalso - not (limit_reached(NewState) orelse internal_is_blocked(NewState)) of + case (limit_reached(OldState) orelse blocked(OldState)) andalso + not (limit_reached(NewState) orelse blocked(NewState)) of true -> NewState1 = notify_queues(NewState), {case NewState1#lim.prefetch_count of 0 -> stop; @@ -208,7 +208,7 @@ maybe_notify(OldState, NewState) -> limit_reached(#lim{prefetch_count = Limit, volume = Volume}) -> Limit =/= 0 andalso Volume >= Limit. -internal_is_blocked(#lim{blocked = Blocked}) -> Blocked. +blocked(#lim{blocked = Blocked}) -> Blocked. remember_queue(QPid, State = #lim{queues = Queues}) -> case dict:is_key(QPid, Queues) of |