Skip to content

Commit 9a2a05c

Browse files
Switch to rabbit_misc:is_process_alive/1
1 parent 1835d72 commit 9a2a05c

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/rabbit_core_metrics_gc.erl

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ gc_process(Table) ->
103103
end, none, Table).
104104

105105
gc_process(Pid, Table, Key) ->
106-
case is_process_alive_in_cluster(Pid) of
106+
case rabbit_misc:is_process_alive(Pid) of
107107
true ->
108108
none;
109109
false ->
@@ -151,7 +151,7 @@ gc_process_and_entity(Table, GbSet) ->
151151
end, none, Table).
152152

153153
gc_process_and_entity(Id, Pid, Table, Key, GbSet) ->
154-
case is_process_alive_in_cluster(Pid) orelse gb_sets:is_member(Id, GbSet) of
154+
case rabbit_misc:is_process_alive(Pid) orelse gb_sets:is_member(Id, GbSet) of
155155
true ->
156156
none;
157157
false ->
@@ -166,18 +166,3 @@ gc_process_and_entities(Table, QueueGbSet, ExchangeGbSet) ->
166166
gc_entity(Q, Table, Key, QueueGbSet),
167167
gc_entity(X, Table, Key, ExchangeGbSet)
168168
end, none, Table).
169-
170-
is_process_alive_in_cluster(Pid) ->
171-
Local = node(),
172-
case node(Pid) of
173-
Local ->
174-
is_process_alive(Pid);
175-
Remote ->
176-
case rabbit_misc:rpc_call(Remote, erlang, is_process_alive, [Pid]) of
177-
Bool when is_boolean(Bool) ->
178-
Bool;
179-
{badrpc, _} ->
180-
%% If the node is unreachable, the process might be dead
181-
false
182-
end
183-
end.

0 commit comments

Comments
 (0)