forked from janek/mostr
fix(main): better messages for background thread operations
This commit is contained in:
parent
2fac3fd8f8
commit
9ad1243078
|
@ -107,7 +107,7 @@ impl Drop for EventSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
enum MostrMessage {
|
pub(crate) enum MostrMessage {
|
||||||
Flush,
|
Flush,
|
||||||
NewRelay(Url),
|
NewRelay(Url),
|
||||||
AddTasks(Url, Vec<Event>),
|
AddTasks(Url, Vec<Event>),
|
||||||
|
@ -237,12 +237,13 @@ async fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(MostrMessage::Flush) | Err(RecvTimeoutError::Timeout) => if let Some((url, events)) = queue {
|
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;
|
client.batch_event_to(vec![url], events, RelaySendOptions::new()).await;
|
||||||
queue = None;
|
queue = None;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!("Finalizing nostr communication thread because of {:?}", err);
|
debug!("Finalizing nostr communication thread because of {:?}: {}", err, err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue