Have app send download analytics meta (#5954)

* wip: add download reasons to app

* update how download meta is gathered

* cargo fmt

* prepr frontend
This commit is contained in:
aecsocket
2026-04-30 20:55:47 +01:00
committed by GitHub
parent 38a39feef1
commit 1875b89556
20 changed files with 195 additions and 32 deletions

View File

@@ -148,6 +148,7 @@ pub async fn download_client(
let bytes = fetch(
&client_download.url,
Some(&client_download.sha1),
None,
&st.fetch_semaphore,
&st.pool,
)
@@ -238,7 +239,7 @@ pub async fn download_assets(
async {
if !resource_path.exists() || force {
let resource = fetch_cell
.get_or_try_init(|| fetch(&url, Some(hash), &st.fetch_semaphore, &st.pool))
.get_or_try_init(|| fetch(&url, Some(hash), None, &st.fetch_semaphore, &st.pool))
.await?;
write(&resource_path, resource, &st.io_semaphore).await?;
tracing::trace!("Fetched asset with hash {hash}");
@@ -252,7 +253,7 @@ pub async fn download_assets(
if with_legacy && !resource_path.exists() || force {
let resource = fetch_cell
.get_or_try_init(|| fetch(&url, Some(hash), &st.fetch_semaphore, &st.pool))
.get_or_try_init(|| fetch(&url, Some(hash), None, &st.fetch_semaphore, &st.pool))
.await?;
write(&resource_path, resource, &st.io_semaphore).await?;
tracing::trace!("Fetched legacy asset with hash {hash}");
@@ -326,6 +327,7 @@ pub async fn download_libraries(
let data = fetch(
&native.url,
Some(&native.sha1),
None,
&st.fetch_semaphore,
&st.pool,
)
@@ -370,6 +372,7 @@ pub async fn download_libraries(
let bytes = fetch(
&artifact.url,
Some(&artifact.sha1),
None,
&st.fetch_semaphore,
&st.pool,
)
@@ -406,7 +409,8 @@ pub async fn download_libraries(
// failed download here is not a fatal condition.
//
// See DEV-479.
match fetch(&url, None, &st.fetch_semaphore, &st.pool).await
match fetch(&url, None, None, &st.fetch_semaphore, &st.pool)
.await
{
Ok(bytes) => {
write(&path, &bytes, &st.io_semaphore).await?;
@@ -465,6 +469,7 @@ pub async fn download_log_config(
let bytes = fetch(
&log_download.url,
Some(&log_download.sha1),
None,
&st.fetch_semaphore,
&st.pool,
)