Send telemetry report to quickinstall if no pre-built is found (#1905)

* 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>
This commit is contained in:
Jiahao XU 2024-09-06 00:43:38 +10:00 committed by GitHub
parent e4bbbff1fd
commit a53d51c083
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: fetcher.clone(),
new_version: package_info.version,
name: package_info.name,
version_req: version_req_str,
@ -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);
}