From 332c8a49036a10a9c253115ba25b25457722fbc0 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Thu, 15 Feb 2024 11:42:00 +1300 Subject: [PATCH] When handling EVENT, advertise to other handlers --- src/nostr.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nostr.rs b/src/nostr.rs index 0ed88d6..53debad 100644 --- a/src/nostr.rs +++ b/src/nostr.rs @@ -66,9 +66,11 @@ impl WebSocketService { } // Store and index the event - // FIXME: send the event to other listeners in case it matches their subs let reply = match GLOBALS.store.get().unwrap().store_event(&event) { - Ok(_) => NostrReply::Ok(event.id(), true, "".to_owned()), + Ok(offset) => { + GLOBALS.new_events.send(offset)?; // advertise the new event + NostrReply::Ok(event.id(), true, "".to_owned()) + }, Err(Error::Duplicate) => NostrReply::Ok(event.id(), true, "duplicate:".to_owned()), Err(e) => NostrReply::Ok(event.id(), false, format!("{e}")), };