summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-03-14 17:23:53 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-03-14 17:23:53 +0000
commit790dd1231f26619fb6a01bb147dff9ae93f4ebe3 (patch)
tree7e2c55cc8d0afb6256ae42ec9627cdae8a3b3f7d
parent1dd3e01cd88f91c54aae9cde43ff92f21c7332de (diff)
downloadrabbitmq-server-790dd1231f26619fb6a01bb147dff9ae93f4ebe3.tar.gz
Only sleep as much as we need, and tail recurse properly.
-rw-r--r--src/rabbit_amqqueue.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 977d302f..badbe7b5 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -428,9 +428,6 @@ info_all(VHostPath, Items) -> map(VHostPath, fun (Q) -> info(Q, Items) end).
force_event_refresh() ->
force_event_refresh([Q#amqqueue.name || Q <- list()]).
-force_event_refresh([]) ->
- ok;
-
force_event_refresh(QNames) ->
Qs = [Q || Q <- list(), lists:member(Q#amqqueue.name, QNames)],
{_, Bad} = rabbit_misc:multi_call(
@@ -438,9 +435,11 @@ force_event_refresh(QNames) ->
FailedPids = [Pid || {Pid, _Reason} <- Bad],
Failed = [Name || #amqqueue{name = Name, pid = Pid} <- Qs,
lists:member(Pid, FailedPids)],
- timer:sleep(100),
- force_event_refresh(Failed),
- ok.
+ case Failed of
+ [] -> ok;
+ _ -> timer:sleep(100),
+ force_event_refresh(Failed)
+ end.
consumers(#amqqueue{ pid = QPid }) ->
delegate_call(QPid, consumers).