diff --git a/src/db.rs b/src/db.rs index d1e774c..a5c1bcc 100644 --- a/src/db.rs +++ b/src/db.rs @@ -212,9 +212,9 @@ pub async fn db_writer( } // TODO: cache recent list of authors to remove a DB call. let start = Instant::now(); - if event.kind >= 20000 && event.kind < 30000 { + if event.is_ephemeral() { bcast_tx.send(event.clone()).ok(); - info!( + debug!( "published ephemeral event: {:?} from: {:?} in: {:?}", event.get_event_id_prefix(), event.get_author_prefix(), diff --git a/src/event.rs b/src/event.rs index 05d2f93..7399109 100644 --- a/src/event.rs +++ b/src/event.rs @@ -120,6 +120,11 @@ impl Event { self.kind == 0 } + /// Should this event be persisted? + #[must_use] pub fn is_ephemeral(&self) -> bool { + self.kind >= 20000 && self.kind < 30000 + } + /// Should this event be replaced with newer timestamps from same author? #[must_use] pub fn is_replaceable(&self) -> bool { self.kind == 0 || self.kind == 3 || self.kind == 41 || (self.kind >= 10000 && self.kind < 20000)