From f8a0698c3a4b0286500e11f3ca2bdd8c77e6e813 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 7 Jan 2024 16:37:06 -0600 Subject: [PATCH] Reqmeister: encounter -> storeEvent --- src/pipeline.ts | 2 +- src/storages/reqmeister.ts | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index de0d310..fb9b334 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -43,7 +43,7 @@ async function handleEvent(event: Event): Promise { async function encounterEvent(event: Event): Promise { const preexisting = (await memorelay.countEvents([{ ids: [event.id] }])) > 0; memorelay.storeEvent(event); - reqmeister.encounter(event); + reqmeister.storeEvent(event); return preexisting; } diff --git a/src/storages/reqmeister.ts b/src/storages/reqmeister.ts index 6ecd09f..1fff6b6 100644 --- a/src/storages/reqmeister.ts +++ b/src/storages/reqmeister.ts @@ -77,7 +77,7 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an const events = await client.getEvents(filters, { signal: AbortSignal.timeout(timeout) }); for (const event of events) { - this.encounter(event); + this.storeEvent(event); } } @@ -119,10 +119,11 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an }); } - encounter(event: Event): void { + storeEvent(event: Event): Promise { const filterId = getFilterId(eventToMicroFilter(event)); this.#queue = this.#queue.filter(([id]) => id !== filterId); this.emit(filterId, event); + return Promise.resolve(); } isWanted(event: Event): boolean { @@ -144,11 +145,6 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an return Promise.all(promises); } - storeEvent(event: Event): Promise { - this.encounter(event); - return Promise.resolve(); - } - countEvents(_filters: Filter[]): Promise { throw new Error('COUNT not implemented.'); }