From 7d2c95c91ccb5adc9df30dd7b116cfa081b1a89f Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:21:09 +1000 Subject: [PATCH] Send telemetry report to quickinstall if no pre-built is found quickinstall telemtry is overloaded cargo-bins/cargo-quickinstall#268, it only needs report when the pre-built is not available in upstream. Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- crates/binstalk/src/ops/resolve.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/binstalk/src/ops/resolve.rs b/crates/binstalk/src/ops/resolve.rs index 87a7dbfc5..4831ec143 100644 --- a/crates/binstalk/src/ops/resolve.rs +++ b/crates/binstalk/src/ops/resolve.rs @@ -175,13 +175,7 @@ async fn resolve_inner( ); } - if !opts.disable_telemetry { - for fetcher in &handles { - fetcher.clone().report_to_upstream(); - } - } - - for fetcher in handles { + for fetcher in &handles { match timeout( opts.maximum_resolution_timeout, AutoAbortJoinHandle::new(fetcher.clone().find()).flattened_join(), @@ -210,7 +204,7 @@ async fn resolve_inner( Ok(bin_files) => { if !bin_files.is_empty() { return Ok(Resolution::Fetch(Box::new(ResolutionFetch { - fetcher, + fetcher.clone(), new_version: package_info.version, name: package_info.name, version_req: version_req_str, @@ -256,6 +250,13 @@ async fn resolve_inner( } } + if !opts.disable_telemetry { + for fetcher in &handles { + fetcher.clone().report_to_upstream(); + } + } + + if !opts.cargo_install_fallback { return Err(BinstallError::NoFallbackToCargoInstall); }