diff --git a/src/queue/process.rs b/src/queue/process.rs index a0f9083..78dc0a0 100644 --- a/src/queue/process.rs +++ b/src/queue/process.rs @@ -10,6 +10,7 @@ use crate::{ use futures_util::{StreamExt, TryStreamExt}; use reqwest_middleware::ClientWithMiddleware; use std::path::PathBuf; +use tracing::Instrument; use url::Url; pub(super) fn perform<'a, R, S>( @@ -245,33 +246,40 @@ async fn prepare_upgrade( let repo = repo.clone(); let store = store.clone(); - let res = actix_rt::spawn(async move { - if let Some(identifier) = repo.identifier(hash).await? { - crate::ensure_details_identifier(&repo, &store, &identifier, None).await?; + let current_span = tracing::Span::current(); + let span = tracing::debug_span!(parent: current_span, "ensure details"); + + let res = actix_rt::spawn( + async move { + if let Some(identifier) = repo.identifier(hash).await? { + crate::ensure_details_identifier(&repo, &store, &identifier, None) + .await?; + } + + repo.set( + "upgrade-preparations-progress", + Vec::from(count.to_be_bytes()).into(), + ) + .await?; + + Ok(()) as Result<(), Error> } - - repo.set( - "upgrade-preparations-progress", - Vec::from(count.to_be_bytes()).into(), - ) - .await?; - - Ok(()) as Result<(), Error> - }) + .instrument(span), + ) .await; match res { Ok(Ok(_)) => {} Ok(Err(e)) => { - tracing::warn!("Failed to ensure details for a hash: {e}"); + tracing::warn!("Failed to ensure details for a hash: {e:?}"); } Err(_) => { - tracing::warn!("Panic while ensuring details for a hash"); + tracing::warn!("ensure details panicked"); } } } Err(e) => { - tracing::warn!("Skipping upgrade check for a hash: {e}"); + tracing::warn!("Skipping ensure details for a hash: {e:?}"); } }