Move Reqmeister to a dedicated storage class
This commit is contained in:
parent
42dfe083bf
commit
ae44c08a2a
|
@ -6,9 +6,8 @@ import { findUser } from '@/db/users.ts';
|
||||||
import { Debug, type Event } from '@/deps.ts';
|
import { Debug, type Event } from '@/deps.ts';
|
||||||
import { isEphemeralKind } from '@/kinds.ts';
|
import { isEphemeralKind } from '@/kinds.ts';
|
||||||
import { isLocallyFollowed } from '@/queries.ts';
|
import { isLocallyFollowed } from '@/queries.ts';
|
||||||
import { reqmeister } from '@/reqmeister.ts';
|
|
||||||
import { updateStats } from '@/stats.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 { Sub } from '@/subs.ts';
|
||||||
import { getTagSet } from '@/tags.ts';
|
import { getTagSet } from '@/tags.ts';
|
||||||
import { type EventData } from '@/types.ts';
|
import { type EventData } from '@/types.ts';
|
||||||
|
|
|
@ -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 { Debug, type Event, findReplyTag } from '@/deps.ts';
|
||||||
import { type AuthorMicrofilter, type DittoFilter, type IdMicrofilter, type Relation } from '@/filter.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 { type DittoEvent } from '@/storages/types.ts';
|
||||||
import { getTagSet } from '@/tags.ts';
|
import { getTagSet } from '@/tags.ts';
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ import { db } from '@/db.ts';
|
||||||
import { EventsDB } from '@/storages/events-db.ts';
|
import { EventsDB } from '@/storages/events-db.ts';
|
||||||
import { Memorelay } from '@/storages/memorelay.ts';
|
import { Memorelay } from '@/storages/memorelay.ts';
|
||||||
import { Optimizer } from '@/storages/optimizer.ts';
|
import { Optimizer } from '@/storages/optimizer.ts';
|
||||||
|
import { Reqmeister } from '@/storages/reqmeister.ts';
|
||||||
import { SearchStore } from '@/storages/search-store.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. */
|
/** SQLite database to store events this Ditto server cares about. */
|
||||||
const eventsDB = new EventsDB(db);
|
const eventsDB = new EventsDB(db);
|
||||||
|
@ -12,6 +13,12 @@ const eventsDB = new EventsDB(db);
|
||||||
/** In-memory data store for cached events. */
|
/** In-memory data store for cached events. */
|
||||||
const memorelay = new Memorelay({ max: 3000 });
|
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 */
|
/** Main Ditto storage adapter */
|
||||||
const optimizer = new Optimizer({
|
const optimizer = new Optimizer({
|
||||||
db: eventsDB,
|
db: eventsDB,
|
||||||
|
@ -25,4 +32,4 @@ const searchStore = new SearchStore({
|
||||||
fallback: optimizer,
|
fallback: optimizer,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { eventsDB, memorelay, optimizer, searchStore };
|
export { eventsDB, memorelay, optimizer, reqmeister, searchStore };
|
||||||
|
|
|
@ -158,9 +158,4 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const reqmeister = new Reqmeister({
|
export { Reqmeister };
|
||||||
delay: Time.seconds(1),
|
|
||||||
timeout: Time.seconds(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export { reqmeister };
|
|
Loading…
Reference in New Issue