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 relaystore = new DittoRelayStore({ db, conf, relay: pgstore });
const apistore = new DittoAPIStore({ relay: relaystore, pool });
const relay = new DittoRelayStore({ db, conf, relay: pgstore });
await seedZapSplits(apistore);
await seedZapSplits(relay);
if (conf.firehoseEnabled) {
startFirehose({
pool,
store: relaystore,
relay,
concurrency: conf.firehoseConcurrency,
kinds: conf.firehoseKinds,
});
}
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. */
const publicFiles = serveStatic({ root: './public/' });
@ -246,7 +245,7 @@ app.get('/api/v1/streaming', socketTokenMiddleware, metricsMiddleware, ratelimit
app.get(
'/relay',
(c, next) => {
c.set('relay', relaystore);
c.set('relay', new DittoAPIStore({ relay, pool }));
return next();
},
metricsMiddleware,

View file

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