summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-02-17 18:44:20 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-02-17 18:44:20 +0000
commita4bb70b0652dd7eae95496a8c0822a586f8e57f7 (patch)
treee769edd416ed24a2d3a905079fbcbab416719fea
parenta838d169331ff3c7328aed49484bfe0c913fad74 (diff)
downloadrabbitmq-server-a4bb70b0652dd7eae95496a8c0822a586f8e57f7.tar.gz
Show state as 'flow' if we are currently flow blocked and have been so for more than 5s.
-rw-r--r--src/rabbit_exchange_type_direct.erl1
-rw-r--r--src/rabbit_reader.erl13
2 files changed, 8 insertions, 6 deletions
diff --git a/src/rabbit_exchange_type_direct.erl b/src/rabbit_exchange_type_direct.erl
index 52704ab6..84511049 100644
--- a/src/rabbit_exchange_type_direct.erl
+++ b/src/rabbit_exchange_type_direct.erl
@@ -38,6 +38,7 @@ serialise_events() -> false.
route(#exchange{name = Name},
#delivery{message = #basic_message{routing_keys = Routes}}) ->
+ timer:sleep(10000),
rabbit_router:match_routing_key(Name, Routes).
validate(_X) -> ok.
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 9ffcd203..c65ba721 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -1073,12 +1073,13 @@ i(peer_cert_subject, S) -> cert_info(fun rabbit_ssl:peer_cert_subject/1, S);
i(peer_cert_validity, S) -> cert_info(fun rabbit_ssl:peer_cert_validity/1, S);
i(channels, #v1{channel_count = ChannelCount}) -> ChannelCount;
i(state, #v1{connection_state = ConnectionState,
- throttle = #throttle{last_blocked_by = BlockedBy,
- last_blocked_at = T}}) ->
- Recent = T =/= never andalso timer:now_diff(erlang:now(), T) < 5000000,
- case {BlockedBy, Recent} of
- {flow, true} -> flow;
- {_, _} -> ConnectionState
+ throttle = #throttle{last_blocked_by = WasBlockedBy,
+ last_blocked_at = T}}) ->
+ Recently = T =/= never andalso timer:now_diff(erlang:now(), T) < 5000000,
+ case {credit_flow:blocked(), WasBlockedBy, Recently} of
+ {true, _, _} -> flow;
+ {false, flow, true} -> flow;
+ {_, _, _} -> ConnectionState
end;
i(Item, #v1{connection = Conn}) -> ic(Item, Conn).