mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
app.ts: minor variable name cleanup
This commit is contained in:
parent
751c09035c
commit
9df50a5b0d
2 changed files with 9 additions and 10 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue