Move Reqmeister to a dedicated storage class

This commit is contained in:
Alex Gleason 2024-01-07 14:54:33 -06:00
parent 42dfe083bf
commit ae44c08a2a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
4 changed files with 12 additions and 12 deletions

View File

@ -6,9 +6,8 @@ import { findUser } from '@/db/users.ts';
import { Debug, type Event } from '@/deps.ts';
import { isEphemeralKind } from '@/kinds.ts';
import { isLocallyFollowed } from '@/queries.ts';
import { reqmeister } from '@/reqmeister.ts';
import { updateStats } from '@/stats.ts';
import { eventsDB, memorelay } from '@/storages.ts';
import { eventsDB, memorelay, reqmeister } from '@/storages.ts';
import { Sub } from '@/subs.ts';
import { getTagSet } from '@/tags.ts';
import { type EventData } from '@/types.ts';

View File

@ -1,7 +1,6 @@
import { eventsDB, memorelay } from '@/storages.ts';
import { eventsDB, memorelay, reqmeister } from '@/storages.ts';
import { Debug, type Event, findReplyTag } from '@/deps.ts';
import { type AuthorMicrofilter, type DittoFilter, type IdMicrofilter, type Relation } from '@/filter.ts';
import { reqmeister } from '@/reqmeister.ts';
import { type DittoEvent } from '@/storages/types.ts';
import { getTagSet } from '@/tags.ts';

View File

@ -3,8 +3,9 @@ import { db } from '@/db.ts';
import { EventsDB } from '@/storages/events-db.ts';
import { Memorelay } from '@/storages/memorelay.ts';
import { Optimizer } from '@/storages/optimizer.ts';
import { Reqmeister } from '@/storages/reqmeister.ts';
import { SearchStore } from '@/storages/search-store.ts';
import { reqmeister } from '@/reqmeister.ts';
import { Time } from '@/utils/time.ts';
/** SQLite database to store events this Ditto server cares about. */
const eventsDB = new EventsDB(db);
@ -12,6 +13,12 @@ const eventsDB = new EventsDB(db);
/** In-memory data store for cached events. */
const memorelay = new Memorelay({ max: 3000 });
/** Batches requests for single events. */
const reqmeister = new Reqmeister({
delay: Time.seconds(1),
timeout: Time.seconds(1),
});
/** Main Ditto storage adapter */
const optimizer = new Optimizer({
db: eventsDB,
@ -25,4 +32,4 @@ const searchStore = new SearchStore({
fallback: optimizer,
});
export { eventsDB, memorelay, optimizer, searchStore };
export { eventsDB, memorelay, optimizer, reqmeister, searchStore };

View File

@ -158,9 +158,4 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an
}
}
const reqmeister = new Reqmeister({
delay: Time.seconds(1),
timeout: Time.seconds(1),
});
export { reqmeister };
export { Reqmeister };