From 477ee8b124f2fddd12e3e0d8c44cd453837ad350 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 14 May 2024 19:09:25 -0500 Subject: [PATCH] Fix hydrateEvents in streaming --- src/controllers/api/streaming.ts | 7 ++++--- src/controllers/api/timelines.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/controllers/api/streaming.ts b/src/controllers/api/streaming.ts index e79c51e..1de7bbf 100644 --- a/src/controllers/api/streaming.ts +++ b/src/controllers/api/streaming.ts @@ -68,15 +68,16 @@ const streamingController: AppController = (c) => { if (!filter) return; try { - const store = await Storages.pubsub(); + const db = await Storages.db(); + const pubsub = await Storages.pubsub(); - for await (const msg of store.req([filter], { signal: controller.signal })) { + for await (const msg of pubsub.req([filter], { signal: controller.signal })) { if (msg[0] === 'EVENT') { const event = msg[2]; await hydrateEvents({ events: [event], - store, + store: db, signal: AbortSignal.timeout(1000), }); diff --git a/src/controllers/api/timelines.ts b/src/controllers/api/timelines.ts index e83c50c..8ea66ba 100644 --- a/src/controllers/api/timelines.ts +++ b/src/controllers/api/timelines.ts @@ -62,7 +62,7 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) { return renderReblog(event, { viewerPubkey }); } return renderStatus(event, { viewerPubkey }); - }))).filter((boolean) => boolean); + }))).filter(Boolean); if (!statuses.length) { return c.json([]);