Skip to content

Commit 8abeda8

Browse files
committed
Refine local queue filter
To handle lookup errors and filter out dead queues.
1 parent 437566d commit 8abeda8

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

deps/rabbit/src/rabbit_exchange_type_local_random.erl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ assert_args_equivalence(X, Args) ->
8181
rabbit_exchange:assert_args_equivalence(X, Args).
8282

8383
filter_local_queue(QName) ->
84-
{ok, Q} = rabbit_amqqueue:lookup(QName),
85-
case amqqueue:get_pid(Q) of
86-
none ->
87-
false;
88-
Pid when is_pid(Pid) ->
89-
node(Pid) =:= node()
90-
end.
84+
case rabbit_amqqueue:lookup(QName) of
85+
{ok, Q} ->
86+
case amqqueue:get_pid(Q) of
87+
Pid when is_pid(Pid) andalso
88+
node(Pid) =:= node() ->
89+
is_process_alive(Pid);
90+
_ ->
91+
false
92+
end;
93+
_ ->
94+
false
95+
end.

0 commit comments

Comments
 (0)