better new event logging

This commit is contained in:
Mike Dilger 2022-12-26 15:21:52 +13:00
parent 0d503a5857
commit 28c2439989
2 changed files with 15 additions and 1 deletions

View File

@ -18,7 +18,12 @@ impl Minion {
if let Err(e) = event.verify(Some(maxtime)) {
error!("VERIFY ERROR: {}, {}", e, serde_json::to_string(&event)?)
} else {
debug!("NEW EVENT ON {}", subid.0);
let handle = self
.subscriptions
.get_handle_by_id(&subid.0)
.unwrap_or_else(|| "_".to_owned());
debug!("NEW EVENT on {} [{}]", &self.url, handle);
crate::process::process_new_event(&event, true, Some(self.url.clone())).await?;
}
}

View File

@ -40,6 +40,15 @@ impl Subscriptions {
self.by_id.get(id).cloned()
}
pub fn get_handle_by_id(&self, id: &str) -> Option<String> {
for (handle, xid) in self.handle_to_id.iter() {
if id == xid {
return Some(handle.to_string());
}
}
None
}
pub fn get_mut(&mut self, handle: &str) -> Option<&mut Subscription> {
match self.handle_to_id.get(handle) {
None => None,