From 9ad12430780a9aa6bc970201c35a970cacbdf6d7 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 16 Aug 2024 17:46:04 +0300 Subject: [PATCH] fix(main): better messages for background thread operations --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index b31e5f6..4335d02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,7 +107,7 @@ impl Drop for EventSender { } #[derive(Debug, Clone, Eq, PartialEq)] -enum MostrMessage { +pub(crate) enum MostrMessage { Flush, NewRelay(Url), AddTasks(Url, Vec), @@ -237,12 +237,13 @@ async fn main() { } } Ok(MostrMessage::Flush) | Err(RecvTimeoutError::Timeout) => if let Some((url, events)) = queue { - info!("Sending {} events to {url} due to {:?}", events.len(), result_received); + info!("Sending {} events to {url} due to {}", events.len(), + result_received.map_or_else(|e| format!("{:?}", e), |m| format!("{:?}", m))); client.batch_event_to(vec![url], events, RelaySendOptions::new()).await; queue = None; } Err(err) => { - debug!("Finalizing nostr communication thread because of {:?}", err); + debug!("Finalizing nostr communication thread because of {:?}: {}", err, err); break; } }