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 { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||||
import { isEphemeralKind } from '@/kinds.ts';
|
import { isEphemeralKind } from '@/kinds.ts';
|
||||||
import { DVM } from '@/pipeline/DVM.ts';
|
import { DVM } from '@/pipeline/DVM.ts';
|
||||||
import { getAuthor } from '@/queries.ts';
|
|
||||||
import { updateStats } from '@/stats.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 { cache, client, eventsDB, reqmeister } from '@/storages.ts';
|
||||||
import { Sub } from '@/subs.ts';
|
import { Sub } from '@/subs.ts';
|
||||||
import { getTagSet } from '@/tags.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 verifyEventWorker(event))) return;
|
||||||
if (await encounterEvent(event, signal)) return;
|
if (await encounterEvent(event, signal)) return;
|
||||||
debug(`NostrEvent<${event.kind}> ${event.id}`);
|
debug(`NostrEvent<${event.kind}> ${event.id}`);
|
||||||
await hydrateEvent(event);
|
await hydrateEvent(event, signal);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
storeEvent(event, signal),
|
storeEvent(event, signal),
|
||||||
|
@ -57,12 +56,8 @@ async function encounterEvent(event: NostrEvent, signal: AbortSignal): Promise<b
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hydrate the event with the user, if applicable. */
|
/** Hydrate the event with the user, if applicable. */
|
||||||
async function hydrateEvent(event: DittoEvent): Promise<void> {
|
async function hydrateEvent(event: DittoEvent, signal: AbortSignal): Promise<void> {
|
||||||
const [user] = await eventsDB.query([{ kinds: [30361], authors: [Conf.pubkey], '#d': [event.pubkey], limit: 1 }]);
|
await hydrateEvents({ events: [event], relations: ['author', 'user'], storage: eventsDB, signal });
|
||||||
event.user = user;
|
|
||||||
|
|
||||||
const author = await getAuthor(event.pubkey);
|
|
||||||
event.author = author;
|
|
||||||
|
|
||||||
const domain = await db
|
const domain = await db
|
||||||
.selectFrom('pubkey_domains')
|
.selectFrom('pubkey_domains')
|
||||||
|
|
Loading…
Reference in New Issue