Skip to content

Commit 2a4ff19

Browse files
committed
Merge remote-tracking branch 'origin/stable'
2 parents b8780f9 + 6f374fb commit 2a4ff19

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

test/rabbit_core_metrics_gc_SUITE.erl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,13 @@ cluster_queue_metrics(Config) ->
370370
ok = rabbit_ct_broker_helpers:rpc(Config, Node0, rabbit_amqqueue,
371371
sync_mirrors, [QPid]),
372372

373-
timer:sleep(1500),
374-
375373
% Check ETS table for data
376-
% rabbit_core_metrics:queue_stats
377-
[] = rabbit_ct_broker_helpers:rpc(Config, Node0, ets, tab2list,
378-
[queue_coarse_metrics]),
374+
wait_for(fun () ->
375+
[] =:= rabbit_ct_broker_helpers:rpc(
376+
Config, Node0, ets, tab2list,
377+
[queue_coarse_metrics])
378+
end, 60),
379+
379380

380381
[{Name, 1, 0, 1, _}] = rabbit_ct_broker_helpers:rpc(Config, Node1, ets,
381382
tab2list,
@@ -384,3 +385,12 @@ cluster_queue_metrics(Config) ->
384385
amqp_channel:call(Ch, #'queue.delete'{queue=QueueName}),
385386
rabbit_ct_client_helpers:close_channel(Ch),
386387
Config.
388+
389+
wait_for(_Fun, 0) -> false;
390+
wait_for(Fun, Seconds) ->
391+
case Fun() of
392+
true -> ok;
393+
false ->
394+
timer:sleep(1000),
395+
wait_for(Fun, Seconds - 1)
396+
end.

0 commit comments

Comments
 (0)