Actually fix the parallel download
This commit is contained in:
parent
3e7601db1d
commit
9d976b49ab
12
src/main.rs
12
src/main.rs
@ -110,13 +110,16 @@ 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) {
|
||||||
// The mutex access must be in its own scope to ensure that the lock is dropped
|
// 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() } {
|
while let Some(dlreq) = {
|
||||||
|
let mut urls = urls.lock().await;
|
||||||
|
urls.pop_front().take()
|
||||||
|
} {
|
||||||
|
println!("Downloading {}", dlreq.url);
|
||||||
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
|
||||||
let url = match is_integrated_url(&dlreq.url) {
|
let url = match is_integrated_url(&dlreq.url) {
|
||||||
Some(service) => {
|
Some(service) => match resolve_integrated_url(&dlreq.url, service).await {
|
||||||
match resolve_integrated_url(&dlreq.url, service).await {
|
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
report_msg!(
|
report_msg!(
|
||||||
@ -126,8 +129,7 @@ async fn download_job(urls: SyncQueue, reporter: UnboundedSender<DlReport>, cli_
|
|||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
|
||||||
None => dlreq.url,
|
None => dlreq.url,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user