Fix parallel file downloads not working

This commit is contained in:
Daniel M 2022-04-01 01:09:37 +02:00
parent a46bc063ff
commit 3e7601db1d

View File

@ -109,7 +109,8 @@ async fn download_multiple(args: CLIArgs, raw_urls: Vec<String>) -> Result<()> {
} }
async fn download_job(urls: SyncQueue, reporter: UnboundedSender<DlReport>, cli_args: CLIArgs) { async fn download_job(urls: SyncQueue, reporter: UnboundedSender<DlReport>, 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()); let reporter = DlReporter::new(dlreq.id as u32, reporter.clone());
// Resolve the zippy url to the direct download url if necessary // Resolve the zippy url to the direct download url if necessary