From 21bec6b13174a208d5d58b516ce370c545badcd2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 30 Mar 2024 23:38:48 -0500 Subject: [PATCH] pipeline: call hydrateEvents from hydrateEvent --- src/pipeline.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index f187570..1c7a891 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -7,9 +7,8 @@ import { Debug, LNURL, type NostrEvent } from '@/deps.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isEphemeralKind } from '@/kinds.ts'; import { DVM } from '@/pipeline/DVM.ts'; -import { getAuthor } from '@/queries.ts'; import { updateStats } from '@/stats.ts'; -import { purifyEvent } from '@/storages/hydrate.ts'; +import { hydrateEvents, purifyEvent } from '@/storages/hydrate.ts'; import { cache, client, eventsDB, reqmeister } from '@/storages.ts'; import { Sub } from '@/subs.ts'; import { getTagSet } from '@/tags.ts'; @@ -31,7 +30,7 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise ${event.id}`); - await hydrateEvent(event); + await hydrateEvent(event, signal); await Promise.all([ storeEvent(event, signal), @@ -57,12 +56,8 @@ async function encounterEvent(event: NostrEvent, signal: AbortSignal): Promise { - const [user] = await eventsDB.query([{ kinds: [30361], authors: [Conf.pubkey], '#d': [event.pubkey], limit: 1 }]); - event.user = user; - - const author = await getAuthor(event.pubkey); - event.author = author; +async function hydrateEvent(event: DittoEvent, signal: AbortSignal): Promise { + await hydrateEvents({ events: [event], relations: ['author', 'user'], storage: eventsDB, signal }); const domain = await db .selectFrom('pubkey_domains')