pipeline: call hydrateEvents from hydrateEvent
This commit is contained in:
parent
c71d3f9d3c
commit
21bec6b131
|
@ -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<void
|
|||
if (!(await verifyEventWorker(event))) return;
|
||||
if (await encounterEvent(event, signal)) return;
|
||||
debug(`NostrEvent<${event.kind}> ${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<b
|
|||
}
|
||||
|
||||
/** Hydrate the event with the user, if applicable. */
|
||||
async function hydrateEvent(event: DittoEvent): Promise<void> {
|
||||
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<void> {
|
||||
await hydrateEvents({ events: [event], relations: ['author', 'user'], storage: eventsDB, signal });
|
||||
|
||||
const domain = await db
|
||||
.selectFrom('pubkey_domains')
|
||||
|
|
Loading…
Reference in New Issue