diff options
| -rw-r--r-- | src/rabbit_amqqueue.erl | 23 |
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). |
