Skip to content

Commit

Permalink
Send telemetry report to quickinstall if no pre-built is found (#1905)
Browse files Browse the repository at this point in the history
* 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>

* Fix resolve.rs

And optimize sending telemtry: Remove unnecessary `<Arc as Clone>::clone`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt of resolve.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
  • Loading branch information
NobodyXu authored Sep 5, 2024
1 parent e4bbbff commit a53d51c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/binstalk/src/ops/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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: fetcher.clone(),
new_version: package_info.version,
name: package_info.name,
version_req: version_req_str,
Expand Down Expand Up @@ -256,6 +250,12 @@ async fn resolve_inner(
}
}

if !opts.disable_telemetry {
for fetcher in handles {
fetcher.report_to_upstream();
}
}

if !opts.cargo_install_fallback {
return Err(BinstallError::NoFallbackToCargoInstall);
}
Expand Down

0 comments on commit a53d51c

Please sign in to comment.