From 51d8621015470a9452212050db4d7447fa2a85df Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 25 Sep 2022 18:46:26 -0500 Subject: [PATCH] Defensively format errors in traces to avoid deadlocks --- src/queue/cleanup.rs | 5 ++--- src/queue/process.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/queue/cleanup.rs b/src/queue/cleanup.rs index 4f07851..687f79b 100644 --- a/src/queue/cleanup.rs +++ b/src/queue/cleanup.rs @@ -6,7 +6,6 @@ use crate::{ store::{Identifier, Store}, }; use futures_util::StreamExt; -use tracing::error; pub(super) fn perform<'a, R, S>( repo: &'a R, @@ -39,7 +38,7 @@ where Cleanup::AllVariants => all_variants::(repo).await?, }, 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"); span.in_scope(|| { for error in errors { - error!("{}", error); + tracing::error!("{}", format!("{}" error)); } }); } diff --git a/src/queue/process.rs b/src/queue/process.rs index 5487b8b..64cbfba 100644 --- a/src/queue/process.rs +++ b/src/queue/process.rs @@ -58,7 +58,7 @@ where } }, Err(e) => { - tracing::warn!("Invalid job: {}", e); + tracing::warn!("Invalid job: {}", format!("{}", e)); } } @@ -113,7 +113,7 @@ where result } Err(e) => { - tracing::warn!("Failed to ingest {}, {:?}", e, e); + tracing::warn!("Failed to ingest {}, {}", format!("{}", e), format!("{:?}", e)); UploadResult::Failure { message: e.to_string(),