improve semaphone usage

This commit is contained in:
2026-04-05 00:03:14 +03:00
parent 87b925be5f
commit 337c7b69e9
+3 -2
View File
@@ -144,11 +144,12 @@ async fn main() -> Result<()> {
} }
let file_path = entry.path().to_path_buf(); let file_path = entry.path().to_path_buf();
let semaphore_clone = Arc::clone(&semaphore);
let sources_clone = Arc::clone(&sources); let sources_clone = Arc::clone(&sources);
let permit = Arc::clone(&semaphore).acquire_owned().await.unwrap();
let task = tokio::spawn(async move { let task = tokio::spawn(async move {
let _permit = semaphore_clone.acquire().await.unwrap(); let _permit = permit;
process_file(&file_path, sources_clone, overwrite, allow_inaccurate).await; process_file(&file_path, sources_clone, overwrite, allow_inaccurate).await;
}); });
tasks.push(task); tasks.push(task);