Skip to content

Commit 94e3b2c

Browse files
LoisSotoLopezmichaelklishin
authored andcommitted
Use functions w/out _process as its more approp.
1 parent 18e667f commit 94e3b2c

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

deps/rabbit/src/rabbit_core_metrics_gc.erl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ gc_global_queues() ->
9696
gc_process_and_entity(consumer_created, GbSet),
9797
ExchangeGbSet = gb_sets:from_list(rabbit_exchange:list_names()),
9898
gc_process_and_entities(channel_queue_exchange_metrics, GbSet, ExchangeGbSet),
99-
gc_process_and_entities(queue_exchange_metrics, GbSet, ExchangeGbSet).
99+
gc_entities(queue_exchange_metrics, GbSet, ExchangeGbSet).
100100

101101
gc_exchanges() ->
102102
Exchanges = rabbit_exchange:list_names(),
103103
GbSet = gb_sets:from_list(Exchanges),
104104
gc_process_and_entity(channel_exchange_metrics, GbSet),
105-
gc_process_and_entity(exchange_metrics, GbSet).
105+
gc_entity(exchange_metrics, GbSet).
106106

107107
gc_nodes() ->
108108
Nodes = rabbit_nodes:list_members(),
@@ -156,6 +156,12 @@ gc_entity(Table, GbSet) ->
156156
({Id = Key, _, _}, none) ->
157157
gc_entity(Id, Table, Key, GbSet);
158158
({Id = Key, _, _, _, _}, none) ->
159+
gc_entity(Id, Table, Key, GbSet);
160+
({Id = Key, _, _, _, _, _}, none)
161+
when Table == exchange_metrics ->
162+
gc_entity(Id, Table, Key, GbSet);
163+
({Id = Key, _, _, _, _, _, _, _, _}, none)
164+
when Table == queue_counter_metrics ->
159165
gc_entity(Id, Table, Key, GbSet)
160166
end, none, Table).
161167

@@ -175,12 +181,6 @@ gc_process_and_entity(Table, GbSet) ->
175181
({{Pid, Id} = Key, _, _, _, _, _}, none)
176182
when Table == channel_exchange_metrics ->
177183
gc_process_and_entity(Id, Pid, Table, Key, GbSet);
178-
({Id = Key, _, _, _, _, _}, none)
179-
when Table == exchange_metrics ->
180-
gc_entity(Id, Table, Key, GbSet);
181-
({Id = Key, _, _, _, _, _, _, _, _}, none)
182-
when Table == queue_counter_metrics ->
183-
gc_entity(Id, Table, Key, GbSet);
184184
({{Id, Pid, _} = Key, _, _, _, _, _, _}, none)
185185
when Table == consumer_created ->
186186
gc_process_and_entity(Id, Pid, Table, Key, GbSet);
@@ -197,13 +197,15 @@ gc_process_and_entity(Id, Pid, Table, Key, GbSet) ->
197197
none
198198
end.
199199

200-
gc_process_and_entities(Table, QueueGbSet, ExchangeGbSet) ->
201-
ets:foldl(fun
202-
({{QueueId, ExchangeId} = Key, _, _}, none)
200+
gc_entities(Table, QueueGbSet, ExchangeGbSet) ->
201+
ets:foldl(fun({{QueueId, ExchangeId} = Key, _, _}, none)
203202
when Table == queue_exchange_metrics ->
204203
gc_entity(QueueId, Table, Key, QueueGbSet),
205-
gc_entity(ExchangeId, Table, Key, ExchangeGbSet);
206-
({{Pid, {Q, X}} = Key, _, _}, none) ->
204+
gc_entity(ExchangeId, Table, Key, ExchangeGbSet)
205+
end, none, Table).
206+
207+
gc_process_and_entities(Table, QueueGbSet, ExchangeGbSet) ->
208+
ets:foldl(fun({{Pid, {Q, X}} = Key, _, _}, none) ->
207209
gc_process(Pid, Table, Key),
208210
gc_entity(Q, Table, Key, QueueGbSet),
209211
gc_entity(X, Table, Key, ExchangeGbSet)

0 commit comments

Comments
 (0)