app.ts: minor variable name cleanup

This commit is contained in:
Alex Gleason 2025-02-23 20:53:48 -06:00
parent 751c09035c
commit 9df50a5b0d
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 9 additions and 10 deletions

View file

@ -197,25 +197,24 @@ const pgstore = new DittoPgStore({
}); });
const pool = new DittoPool({ conf, relay: pgstore }); const pool = new DittoPool({ conf, relay: pgstore });
const relaystore = new DittoRelayStore({ db, conf, relay: pgstore }); const relay = new DittoRelayStore({ db, conf, relay: pgstore });
const apistore = new DittoAPIStore({ relay: relaystore, pool });
await seedZapSplits(apistore); await seedZapSplits(relay);
if (conf.firehoseEnabled) { if (conf.firehoseEnabled) {
startFirehose({ startFirehose({
pool, pool,
store: relaystore, relay,
concurrency: conf.firehoseConcurrency, concurrency: conf.firehoseConcurrency,
kinds: conf.firehoseKinds, kinds: conf.firehoseKinds,
}); });
} }
if (conf.cronEnabled) { if (conf.cronEnabled) {
cron({ conf, db, relay: relaystore }); cron({ conf, db, relay });
} }
const app = new DittoApp({ conf, db, relay: relaystore }, { strict: false }); const app = new DittoApp({ conf, db, relay }, { strict: false });
/** User-provided files in the gitignored `public/` directory. */ /** User-provided files in the gitignored `public/` directory. */
const publicFiles = serveStatic({ root: './public/' }); const publicFiles = serveStatic({ root: './public/' });
@ -246,7 +245,7 @@ app.get('/api/v1/streaming', socketTokenMiddleware, metricsMiddleware, ratelimit
app.get( app.get(
'/relay', '/relay',
(c, next) => { (c, next) => {
c.set('relay', relaystore); c.set('relay', new DittoAPIStore({ relay, pool }));
return next(); return next();
}, },
metricsMiddleware, metricsMiddleware,

View file

@ -7,7 +7,7 @@ import { nostrNow } from '@/utils.ts';
interface FirehoseOpts { interface FirehoseOpts {
pool: NRelay; pool: NRelay;
store: NStore; relay: NStore;
concurrency: number; concurrency: number;
kinds: number[]; kinds: number[];
timeout?: number; timeout?: number;
@ -19,7 +19,7 @@ interface FirehoseOpts {
* and storing events for notifications and the home feed. * and storing events for notifications and the home feed.
*/ */
export async function startFirehose(opts: FirehoseOpts): Promise<void> { export async function startFirehose(opts: FirehoseOpts): Promise<void> {
const { pool, store, kinds, concurrency, timeout = 5000 } = opts; const { pool, relay, kinds, concurrency, timeout = 5000 } = opts;
const sem = new Semaphore(concurrency); const sem = new Semaphore(concurrency);
@ -32,7 +32,7 @@ export async function startFirehose(opts: FirehoseOpts): Promise<void> {
sem.lock(async () => { sem.lock(async () => {
try { try {
await store.event(event, { signal: AbortSignal.timeout(timeout) }); await relay.event(event, { signal: AbortSignal.timeout(timeout) });
} catch { } catch {
// Ignore // Ignore
} }