mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Add span to spawned prune task
This commit is contained in:
parent
91688d1b95
commit
4223d8a36f
1 changed files with 23 additions and 16 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue