Skip to content

Commit 2f88068

Browse files
committed
Take "true" case into consideration
Fixes #1682 Call E() instead of crashing with badmatch, retry when queue is mirrored
1 parent bc662bc commit 2f88068

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/rabbit_amqqueue.erl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,27 @@ retry_wait(Q = #amqqueue{pid = QPid, name = Name, state = QState}, F, E, Retries
583583
%% there are no slaves to migrate to
584584
{stopped, false} ->
585585
E({absent, Q, stopped});
586+
{_, true} ->
587+
case rabbit_mnesia:is_process_alive(QPid) of
588+
true ->
589+
% rabbitmq-server#1682 - No need to sleep if the
590+
% queue process has become active in the time between
591+
% the case statement above (in with/4) and now
592+
ok;
593+
false ->
594+
timer:sleep(30)
595+
end,
596+
with(Name, F, E, RetriesLeft - 1);
586597
_ ->
587-
false = rabbit_mnesia:is_process_alive(QPid),
588-
timer:sleep(30),
589-
with(Name, F, E, RetriesLeft - 1)
598+
case rabbit_mnesia:is_process_alive(QPid) of
599+
true ->
600+
% rabbitmq-server#1682 - absent & alive is weird,
601+
% but better than crashing with badmatch,true
602+
E({absent, Q, alive});
603+
false ->
604+
timer:sleep(30),
605+
with(Name, F, E, RetriesLeft - 1)
606+
end
590607
end.
591608

592609
with(Name, F) -> with(Name, F, fun (E) -> {error, E} end).

0 commit comments

Comments
 (0)