2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Improve ensure details warnings

This commit is contained in:
asonix 2023-12-11 13:15:11 -06:00
parent b35716254b
commit 63fe3a047f

View file

@ -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<R: FullRepo + 'static, S: Store + 'static>(
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:?}");
}
}