Process events that are not text notes immediately

This commit is contained in:
Mike Dilger 2023-01-02 23:47:02 +13:00
parent e05b68f05e
commit e64c85a5ea

View File

@ -2,7 +2,7 @@ use super::Minion;
use crate::globals::GLOBALS; use crate::globals::GLOBALS;
use crate::Error; use crate::Error;
use futures::SinkExt; use futures::SinkExt;
use nostr_types::{RelayMessage, Unixtime}; use nostr_types::{EventKind, RelayMessage, Unixtime};
use tracing::{debug, error, info, warn}; use tracing::{debug, error, info, warn};
use tungstenite::protocol::Message as WsMessage; use tungstenite::protocol::Message as WsMessage;
@ -32,11 +32,18 @@ impl Minion {
.unwrap_or_else(|| "_".to_owned()); .unwrap_or_else(|| "_".to_owned());
debug!("{}: {}: NEW EVENT", &self.url, handle); debug!("{}: {}: NEW EVENT", &self.url, handle);
GLOBALS if event.kind == EventKind::TextNote {
.incoming_events // Just store text notes in incoming
.write() GLOBALS
.await .incoming_events
.push((*event, self.url.clone())); .write()
.await
.push((*event, self.url.clone()));
} else {
// Process everything else immediately
crate::process::process_new_event(&event, true, Some(self.url.clone()))
.await?;
}
} }
} }
RelayMessage::Notice(msg) => { RelayMessage::Notice(msg) => {