Massively improves the boot speed by: (#41)

1. ignoring duplicated events coming to the client
2. avoiding checking for trust in disk for every event (uses a simple cache)
This commit is contained in:
Vitor Pamplona
2025-05-21 20:18:09 -04:00
committed by GitHub
parent b0a6b73801
commit 45564c7722
2 changed files with 19 additions and 5 deletions

View File

@@ -147,6 +147,8 @@ fn main() {
let new_id = SubscriptionId::new(NEW_MESSAGE_SUB_ID);
let mut notifications = client.notifications();
let mut processed_events: HashSet<EventId> = HashSet::new();
while let Ok(notification) = notifications.recv().await {
if let RelayPoolNotification::Message { message, .. } = notification {
match message {
@@ -154,6 +156,9 @@ fn main() {
event,
subscription_id,
} => {
if processed_events.contains(&event.id) { continue }
processed_events.insert(event.id);
match event.kind {
Kind::GiftWrap => {
let event = match get_unwrapped(event.id).await {