Fix hydrateEvents in streaming

This commit is contained in:
Alex Gleason 2024-05-14 19:09:25 -05:00
parent d3a7f0849f
commit 477ee8b124
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 4 deletions

View File

@ -68,15 +68,16 @@ const streamingController: AppController = (c) => {
if (!filter) return; if (!filter) return;
try { 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') { if (msg[0] === 'EVENT') {
const event = msg[2]; const event = msg[2];
await hydrateEvents({ await hydrateEvents({
events: [event], events: [event],
store, store: db,
signal: AbortSignal.timeout(1000), signal: AbortSignal.timeout(1000),
}); });

View File

@ -62,7 +62,7 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
return renderReblog(event, { viewerPubkey }); return renderReblog(event, { viewerPubkey });
} }
return renderStatus(event, { viewerPubkey }); return renderStatus(event, { viewerPubkey });
}))).filter((boolean) => boolean); }))).filter(Boolean);
if (!statuses.length) { if (!statuses.length) {
return c.json([]); return c.json([]);