diff --git a/src/main.rs b/src/main.rs index 16f2c66..8de4319 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,7 +109,8 @@ async fn download_multiple(args: CLIArgs, raw_urls: Vec) -> Result<()> { } async fn download_job(urls: SyncQueue, reporter: UnboundedSender, cli_args: CLIArgs) { - while let Some(dlreq) = urls.lock().await.pop_front() { + // The mutex access must be in its own scope to ensure that the lock is dropped + while let Some(dlreq) = { urls.lock().await.pop_front() } { let reporter = DlReporter::new(dlreq.id as u32, reporter.clone()); // Resolve the zippy url to the direct download url if necessary