mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-03 02:30:02 +00:00
Optimize Fetcher::find
and fix quickinstall reporting (#579)
* Optimize `Fetcher::find`: Make it non-async to avoid boxing and return `AutoAbortJoinHandle<...>` instead. Since spawning a new task in tokio box the future anyway, boxing the returned future again in `Fetcher::find` merely adds unnecessary overheads. * Optimize `QuickInstall::report`: Make it async fn instead of ret `JoinHandle` This provides several benefits: - On debug build, no task will be spawned - The calls to `self.stats_url()` can be evaluated in parallel. - The task now returns `()` so that the task spawned is smaller. * Fix `QuickInstall::find`: `warn!` if quickinstall report fails Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
ff737730f4
commit
ab3e47c42b
4 changed files with 93 additions and 84 deletions
|
@ -20,7 +20,7 @@ use crate::{
|
|||
drivers::fetch_crate_cratesio,
|
||||
errors::BinstallError,
|
||||
fetchers::{Data, Fetcher, TargetData},
|
||||
helpers::{remote::Client, tasks::AutoAbortJoinHandle},
|
||||
helpers::remote::Client,
|
||||
manifests::cargo_toml_binstall::{Meta, PkgMeta, PkgOverride},
|
||||
};
|
||||
|
||||
|
@ -162,10 +162,7 @@ async fn resolve_inner(
|
|||
.cartesian_product(resolvers)
|
||||
.map(|(target_data, f)| {
|
||||
let fetcher = f(opts.client.clone(), data.clone(), target_data);
|
||||
(
|
||||
fetcher.clone(),
|
||||
AutoAbortJoinHandle::spawn(async move { fetcher.find().await }),
|
||||
)
|
||||
(fetcher.clone(), fetcher.find())
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue