summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2018-08-27 11:17:07 -0700
committerLuke Bakken <lbakken@pivotal.io>2018-12-14 07:47:54 -0800
commit2f88068b273a3385e3fb818ec378bef3baa7e850 (patch)
treed43cbf67da54e79f2e466149ae42bb4235da8915 /src
parentbc662bc0a807f5b0ad0681fb2bcf49534f93729c (diff)
downloadrabbitmq-server-git-2f88068b273a3385e3fb818ec378bef3baa7e850.tar.gz
Take "true" case into consideration
Fixes #1682 Call E() instead of crashing with badmatch, retry when queue is mirrored
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue.erl23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 016443bb73..53cacdb2e6 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -583,10 +583,27 @@ retry_wait(Q = #amqqueue{pid = QPid, name = Name, state = QState}, F, E, Retries
%% there are no slaves to migrate to
{stopped, false} ->
E({absent, Q, stopped});
+ {_, true} ->
+ case rabbit_mnesia:is_process_alive(QPid) of
+ true ->
+ % rabbitmq-server#1682 - No need to sleep if the
+ % queue process has become active in the time between
+ % the case statement above (in with/4) and now
+ ok;
+ false ->
+ timer:sleep(30)
+ end,
+ with(Name, F, E, RetriesLeft - 1);
_ ->
- false = rabbit_mnesia:is_process_alive(QPid),
- timer:sleep(30),
- with(Name, F, E, RetriesLeft - 1)
+ case rabbit_mnesia:is_process_alive(QPid) of
+ true ->
+ % rabbitmq-server#1682 - absent & alive is weird,
+ % but better than crashing with badmatch,true
+ E({absent, Q, alive});
+ false ->
+ timer:sleep(30),
+ with(Name, F, E, RetriesLeft - 1)
+ end
end.
with(Name, F) -> with(Name, F, fun (E) -> {error, E} end).