Skip to content

Commit

Permalink
metrics: removed race condition from global_queue_depth_multi_thread …
Browse files Browse the repository at this point in the history
…test (#6936)
  • Loading branch information
jofas authored Oct 27, 2024
1 parent 946401c commit 070a825
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tokio/tests/rt_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ fn global_queue_depth_current_thread() {

#[test]
fn global_queue_depth_multi_thread() {
let rt = threaded();
let metrics = rt.metrics();

for _ in 0..10 {
let rt = threaded();
let metrics = rt.metrics();

if let Ok(_blocking_tasks) = try_block_threaded(&rt) {
for i in 0..10 {
assert_eq!(i, metrics.global_queue_depth());
Expand All @@ -93,7 +93,7 @@ fn try_block_threaded(rt: &Runtime) -> Result<Vec<mpsc::Sender<()>>, mpsc::RecvT

// Spawn a task per runtime worker to block it.
rt.spawn(async move {
tx.send(()).unwrap();
tx.send(()).ok();
barrier.recv().ok();
});

Expand Down

0 comments on commit 070a825

Please sign in to comment.