From 193dd1a011374fc85c8a857e071dabdfb04853a6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 4 Jul 2024 23:38:16 +0100 Subject: [PATCH] EventsDB: remove queries for ephemeral kinds --- src/storages/EventsDB.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storages/EventsDB.ts b/src/storages/EventsDB.ts index ce74f20d..f640cc45 100644 --- a/src/storages/EventsDB.ts +++ b/src/storages/EventsDB.ts @@ -279,6 +279,12 @@ class EventsDB implements NStore { filter.search = tokens.filter((t) => typeof t === 'string').join(' '); } + + if (filter.kinds) { + // Ephemeral events are not stored, so don't bother querying for them. + // If this results in an empty kinds array, NDatabase will remove the filter before querying and return no results. + filter.kinds = filter.kinds.filter((kind) => !NKinds.ephemeral(kind)); + } } return filters;