From e167b578108b4470e52c49b63d96e56b1f294159 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 16 Oct 2025 19:20:54 +0200 Subject: [PATCH] fix(api): align article-og relay usage to RelayPool.request and remove open/close --- api/article-og.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/api/article-og.ts b/api/article-og.ts index 0253e882..3e0f081b 100644 --- a/api/article-og.ts +++ b/api/article-og.ts @@ -58,15 +58,14 @@ async function fetchEventsFromRelays( timeoutMs: number ): Promise { const events: NostrEvent[] = [] - + await new Promise((resolve) => { const timeout = setTimeout(() => resolve(), timeoutMs) - - relayPool.req(relayUrls, filter).subscribe({ - next: (msg) => { - if (msg.type === 'EVENT') { - events.push(msg.event) - } + + // `request` emits NostrEvent objects directly + relayPool.request(relayUrls, filter).subscribe({ + next: (event) => { + events.push(event) }, error: () => resolve(), complete: () => { @@ -92,9 +91,8 @@ async function fetchArticleMetadata(naddr: string): Promise 0 ? pointer.relays : RELAYS - relayUrls.forEach(url => relayPool.open(url)) // Fetch article and profile in parallel const [articleEvents, profileEvents] = await Promise.all([ @@ -142,7 +140,7 @@ async function fetchArticleMetadata(naddr: string): Promise