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.'); }