summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-05-17 11:14:36 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-05-17 11:14:36 +0100
commit04c6113a9f40b08868b4c32cd1467002d849722c (patch)
tree294b455c6bdce58625fd33dd2189c91c9362abf0
parente250d532c13f87c938653812ced8721e5eb3259d (diff)
downloadrabbitmq-server-04c6113a9f40b08868b4c32cd1467002d849722c.tar.gz
Not especially happy with this but can't think of how else to solve this. If the queue has mirrors then you may well find that during death you try to contact a dead queue process, because the mnesia table is yet to be updated. In such cases, loop.
-rw-r--r--src/rabbit_amqqueue.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index d79fe9df..534d1002 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -256,8 +256,13 @@ lookup(Name) ->
with(Name, F, E) ->
case lookup(Name) of
- {ok, Q} -> rabbit_misc:with_exit_handler(E, fun () -> F(Q) end);
- {error, not_found} -> E()
+ {ok, Q = #amqqueue{mirror_pids = []}} ->
+ rabbit_misc:with_exit_handler(E, fun () -> F(Q) end);
+ {ok, Q} ->
+ E1 = fun () -> with(Name, F, E) end,
+ rabbit_misc:with_exit_handler(E1, fun () -> F(Q) end);
+ {error, not_found} ->
+ E()
end.
with(Name, F) ->