Skip to content

Commit

Permalink
download dependencies in parallel (#64)
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
m1guelpf authored Jun 29, 2024
1 parent f14a38f commit c41c19b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/dependency_downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ pub async fn download_dependencies(
clean_dependency_directory();
}
// downloading dependencies to dependencies folder
for dependency in dependencies.iter() {
let file_name: String = format!("{}-{}.zip", dependency.name, dependency.version);
match download_dependency(&file_name, &dependency.url).await {
Ok(_) => {}
Err(err) => {
return Err(err);
}
futures::future::join_all(dependencies.iter().map(|dep| {
async {
let file_name: String = format!("{}-{}.zip", dep.name, dep.version);
download_dependency(&file_name, &dep.url).await
}
}
}))
.await
.into_iter()
.collect::<Result<_, _>>()?;

Ok(())
}

Expand Down

0 comments on commit c41c19b

Please sign in to comment.