Defensively format errors in traces to avoid deadlocks

This commit is contained in:
asonix 2022-09-25 18:46:26 -05:00
parent 890478e794
commit 51d8621015
2 changed files with 4 additions and 5 deletions

View File

@ -6,7 +6,6 @@ use crate::{
store::{Identifier, Store}, store::{Identifier, Store},
}; };
use futures_util::StreamExt; use futures_util::StreamExt;
use tracing::error;
pub(super) fn perform<'a, R, S>( pub(super) fn perform<'a, R, S>(
repo: &'a R, repo: &'a R,
@ -39,7 +38,7 @@ where
Cleanup::AllVariants => all_variants::<R, S>(repo).await?, Cleanup::AllVariants => all_variants::<R, S>(repo).await?,
}, },
Err(e) => { Err(e) => {
tracing::warn!("Invalid job: {}", e); tracing::warn!("Invalid job: {}", format!("{}", e));
} }
} }
@ -69,7 +68,7 @@ where
let span = tracing::error_span!("Error deleting files"); let span = tracing::error_span!("Error deleting files");
span.in_scope(|| { span.in_scope(|| {
for error in errors { for error in errors {
error!("{}", error); tracing::error!("{}", format!("{}" error));
} }
}); });
} }

View File

@ -58,7 +58,7 @@ where
} }
}, },
Err(e) => { Err(e) => {
tracing::warn!("Invalid job: {}", e); tracing::warn!("Invalid job: {}", format!("{}", e));
} }
} }
@ -113,7 +113,7 @@ where
result result
} }
Err(e) => { Err(e) => {
tracing::warn!("Failed to ingest {}, {:?}", e, e); tracing::warn!("Failed to ingest {}, {}", format!("{}", e), format!("{:?}", e));
UploadResult::Failure { UploadResult::Failure {
message: e.to_string(), message: e.to_string(),