mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29: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 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,
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue