Switch to rabbit_misc:is_process_alive/1

This commit is contained in:
Michael Klishin 2017-03-06 23:07:01 +03:00
parent 7d6588a5d3
commit 2c5ee14b5b
1 changed files with 3 additions and 18 deletions

View File

@ -133,7 +133,7 @@ gc_process(Table) ->
end, none, Table).
gc_process(Pid, Table, Key) ->
case is_process_alive_in_cluster(Pid) of
case rabbit_misc:is_process_alive(Pid) of
true ->
none;
false ->
@ -195,7 +195,7 @@ gc_process_and_entity(Table, GbSet) ->
end, none, Table).
gc_process_and_entity(Id, Pid, Table, Key, GbSet) ->
case is_process_alive_in_cluster(Pid) orelse gb_sets:is_member(Id, GbSet) of
case rabbit_misc:is_process_alive(Pid) orelse gb_sets:is_member(Id, GbSet) of
true ->
none;
false ->
@ -204,7 +204,7 @@ gc_process_and_entity(Id, Pid, Table, Key, GbSet) ->
end.
gc_object(Pid, Table, Object) ->
case is_process_alive_in_cluster(Pid) of
case rabbit_misc:is_process_alive(Pid) of
true ->
none;
false ->
@ -235,18 +235,3 @@ gc_entities(Table, QueueGbSet, ExchangeGbSet) ->
gc_object(Q, Table, Object, QueueGbSet),
gc_entity(X, Table, X, ExchangeGbSet)
end, none, Table).
is_process_alive_in_cluster(Pid) ->
Local = node(),
case node(Pid) of
Local ->
is_process_alive(Pid);
Remote ->
case rabbit_misc:rpc_call(Remote, erlang, is_process_alive, [Pid]) of
Bool when is_boolean(Bool) ->
Bool;
{badrpc, _} ->
%% If the node is unreachable, the process might be dead
false
end
end.