mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'firehose-kinds' into 'main'
Add FIREHOSE_KINDS variable See merge request soapbox-pub/ditto!501
This commit is contained in:
commit
cc2b5cf66a
2 changed files with 7 additions and 1 deletions
|
|
@ -209,6 +209,12 @@ class Conf {
|
|||
static get firehoseConcurrency(): number {
|
||||
return Math.ceil(Number(Deno.env.get('FIREHOSE_CONCURRENCY') ?? (Conf.pg.poolSize * 0.25)));
|
||||
}
|
||||
/** Nostr event kinds of events to listen for on the firehose. */
|
||||
static get firehoseKinds(): number[] {
|
||||
return (Deno.env.get('FIREHOSE_KINDS') ?? '0, 1, 3, 5, 6, 7, 9735, 10002')
|
||||
.split(/[, ]+/g)
|
||||
.map(Number);
|
||||
}
|
||||
/** Whether to enable Ditto cron jobs. */
|
||||
static get cronEnabled(): boolean {
|
||||
return optionalBooleanSchema.parse(Deno.env.get('CRON_ENABLED')) ?? true;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const sem = new Semaphore(Conf.firehoseConcurrency);
|
|||
export async function startFirehose(): Promise<void> {
|
||||
const store = await Storages.client();
|
||||
|
||||
for await (const msg of store.req([{ kinds: [0, 1, 3, 5, 6, 7, 9735, 10002], limit: 0, since: nostrNow() }])) {
|
||||
for await (const msg of store.req([{ kinds: Conf.firehoseKinds, limit: 0, since: nostrNow() }])) {
|
||||
if (msg[0] === 'EVENT') {
|
||||
const event = msg[2];
|
||||
console.debug(`NostrEvent<${event.kind}> ${event.id}`);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue