diff --git a/infrastructure/src/downloader.rs b/infrastructure/src/downloader.rs index 09eeb9c..2fb1935 100644 --- a/infrastructure/src/downloader.rs +++ b/infrastructure/src/downloader.rs @@ -221,6 +221,11 @@ mod tests { thread::sleep(Duration::from_millis(20)); self.active.fetch_sub(1, Ordering::SeqCst); } else { + if task == 1 { + while self.active.load(Ordering::SeqCst) == 0 { + thread::yield_now(); + } + } if task == 2 && self.active.load(Ordering::SeqCst) > 0 { self.task_two_started_while_task_zero_active .fetch_add(1, Ordering::SeqCst);