Merge remote-tracking branch 'origin/main' into recompute

This commit is contained in:
Alex Gleason 2024-05-14 19:43:50 -05:00
commit 374dc3495c
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
5 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import { JsonParseStream } from '@std/json/json-parse-stream';
import { TextLineStream } from '@std/streams/text-line-stream';
import { db } from '@/db.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { AdminSigner } from '@/signers/AdminSigner.ts';
import { EventsDB } from '@/storages/events-db.ts';
import { type EventStub } from '@/utils/api.ts';
@ -9,7 +9,8 @@ import { nostrNow } from '@/utils.ts';
const signer = new AdminSigner();
const eventsDB = new EventsDB(db);
const kysely = await DittoDB.getInstance();
const eventsDB = new EventsDB(kysely);
const readable = Deno.stdin.readable
.pipeThrough(new TextDecoderStream())

View File

@ -1,12 +1,13 @@
import { NSchema } from '@nostrify/nostrify';
import { db } from '@/db.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { Conf } from '@/config.ts';
import { AdminSigner } from '@/signers/AdminSigner.ts';
import { EventsDB } from '@/storages/events-db.ts';
import { nostrNow } from '@/utils.ts';
const eventsDB = new EventsDB(db);
const kysely = await DittoDB.getInstance();
const eventsDB = new EventsDB(kysely);
const [pubkey, role] = Deno.args;

View File

@ -1,4 +1,4 @@
import { NostrEvent, NostrFilter, NSchema as n } from '@nostrify/nostrify';
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
import ISO6391 from 'iso-639-1';
import { z } from 'zod';

View File

@ -68,15 +68,16 @@ const streamingController: AppController = (c) => {
if (!filter) return;
try {
const store = await Storages.pubsub();
const pubsub = await Storages.pubsub();
const optimizer = await Storages.optimizer();
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: optimizer,
signal: AbortSignal.timeout(1000),
});

View File

@ -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([]);