Add span to spawned prune task

This commit is contained in:
asonix 2023-12-12 17:43:10 -06:00
parent 91688d1b95
commit 4223d8a36f

View file

@ -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<u64, Error>
})
Ok(count) as Result<u64, Error>
}
.instrument(span),
)
.await;
match res {