mirror of
https://github.com/arabianq/lyrics_fetcher.git
synced 2026-04-28 08:01:22 +00:00
improve semaphone usage
This commit is contained in:
+3
-2
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user