diff --git a/src/main.rs b/src/main.rs index 9f2121b..51b54df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,7 +104,7 @@ async fn main() -> io::Result<()> { let task = tokio::spawn( async move { tracing::debug!("Prepare to acquire a permit to start"); - let _ = permits.acquire().await.unwrap(); + let _permit = permits.acquire().await.unwrap(); tracing::info!("Start to read file"); let buf = fs::read(&task.file).await?; @@ -147,9 +147,11 @@ async fn main() -> io::Result<()> { }) .progress_chars("#>-"); process.set_style(style); - while analyzed_size.load(Ordering::Acquire) < total_size - && !finished_flag.load(Ordering::Acquire) - { + while analyzed_size.load(Ordering::Acquire) < total_size { + if finished_flag.load(Ordering::Acquire) { + tracing::warn!("Some tasks failed to complete"); + break; + } process.set_position(analyzed_size.load(Ordering::Acquire) as u64); sleep(Duration::from_millis(100)).await; }