From 56ba689f976af8dd34a08f22636eedd29a31ee77 Mon Sep 17 00:00:00 2001 From: Implementor <691cca7a870db1dad6990d5938d1b4a2a2ca9647ca81290b536c17b06b2e473f@buzz.block.builderlab.xyz> Date: Mon, 28 Sep 2026 13:22:42 +1000 Subject: [PATCH] fix(db): limit event transactions to listener mention kinds Signed-off-by: Implementor <691cca7a870db1dad6990d5938d1b4a2a2ca9647ca81290b536c17b06b2e473f@buzz.block.builderlab.xyz> --- crates/buzz-db/src/store/event.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/buzz-db/src/store/event.rs b/crates/buzz-db/src/store/event.rs index 537f338030a..6259a02c5df 100644 --- a/crates/buzz-db/src/store/event.rs +++ b/crates/buzz-db/src/store/event.rs @@ -355,15 +355,19 @@ pub async fn insert_event( event: &Event, channel_id: Option, ) -> Result<(StoredEvent, bool)> { - let connection = crate::observability::acquire_writer( + let mut connection = crate::observability::acquire_writer( pool, crate::observability::WriterOperation::EventWrite, ) .await?; - let mut tx = Transaction::begin(connection, None).await?; - let result = insert_event_in_transaction(&mut tx, community_id, event, channel_id).await?; - tx.commit().await?; - Ok(result) + if crate::operator_listener::is_listener_mention_kind(u32::from(event.kind.as_u16())) { + let mut tx = Transaction::begin(connection, None).await?; + let result = insert_event_in_transaction(&mut tx, community_id, event, channel_id).await?; + tx.commit().await?; + Ok(result) + } else { + insert_event_on(&mut connection, community_id, event, channel_id).await + } } /// Insert a Nostr event in a caller-owned PostgreSQL transaction.