Run artifact discover in sequential instead of in parallel (#1796)

* Perform artifact discovery in sequential

Run different `fetcher.find()` in sequential

* FuturesResolver: Fallback to other future if one error

* Fix typo

* Apply cargo fmt

* Parallelise `<QuickInstall as Fetcher>::find`

Check for signature in parallel to the package

* Download signature in `<QuickInstall as Fetcher>::find`

So that the signature download can be done in parallel.

* Bump msrv for binstalk-fetchers to 1.70

* Update crates/binstalk-fetchers/src/futures_resolver.rs

Co-authored-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* cargo fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
This commit is contained in:
Jiahao XU 2024-06-23 20:42:03 +10:00 committed by GitHub
parent ebdca1126e
commit ac7bac651d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 128 additions and 54 deletions

View file

@ -97,7 +97,7 @@ async fn resolve_inner(
_ => None,
};
let mut handles: Vec<(Arc<dyn Fetcher>, _)> = Vec::with_capacity(
let mut handles: Vec<Arc<dyn Fetcher>> = Vec::with_capacity(
desired_targets.len() * resolvers.len()
+ if binary_name.is_some() {
desired_targets.len()
@ -139,8 +139,7 @@ async fn resolve_inner(
target_data,
opts.signature_policy,
);
filter_fetcher_by_name_predicate(fetcher.fetcher_name())
.then_some((fetcher.clone(), AutoAbortJoinHandle::new(fetcher.find())))
filter_fetcher_by_name_predicate(fetcher.fetcher_name()).then_some(fetcher)
}),
)
};
@ -165,9 +164,12 @@ async fn resolve_inner(
);
}
for (fetcher, handle) in handles {
for fetcher in handles {
fetcher.clone().report_to_upstream();
match handle.flattened_join().await {
match AutoAbortJoinHandle::new(fetcher.clone().find())
.flattened_join()
.await
{
Ok(true) => {
// Generate temporary binary path
let bin_path = opts.temp_dir.join(format!(