diff --git a/src/queue/cleanup.rs b/src/queue/cleanup.rs index cf4dc40..6fccf9b 100644 --- a/src/queue/cleanup.rs +++ b/src/queue/cleanup.rs @@ -7,6 +7,7 @@ use crate::{ }; use futures_util::TryStreamExt; use reqwest_middleware::ClientWithMiddleware; +use tracing::Instrument; pub(super) fn perform<'a, R, S>( repo: &'a R, @@ -198,28 +199,34 @@ where let repo = repo.clone(); let store = store.clone(); - let res = actix_rt::spawn(async move { - let mut count = count; + let current_span = tracing::Span::current(); + let span = tracing::debug_span!(parent: current_span, "ensure details"); - if let Some(ident) = repo.identifier(hash.clone()).await? { - match store.len(&ident).await { - Err(e) if e.is_not_found() => { - super::cleanup_hash(&repo, hash).await?; + let res = actix_rt::spawn( + async move { + let mut count = count; - count += 1; + if let Some(ident) = repo.identifier(hash.clone()).await? { + match store.len(&ident).await { + Err(e) if e.is_not_found() => { + super::cleanup_hash(&repo, hash).await?; - repo.set( - "prune-missing-queued", - Vec::from(count.to_be_bytes()).into(), - ) - .await?; + count += 1; + + repo.set( + "prune-missing-queued", + Vec::from(count.to_be_bytes()).into(), + ) + .await?; + } + _ => (), } - _ => (), } - } - Ok(count) as Result - }) + Ok(count) as Result + } + .instrument(span), + ) .await; match res {