refactor: migrate chats to relay worker cache

This commit is contained in:
2024-01-23 22:16:43 +00:00
parent c968fa43a6
commit e9d9bf34d8
11 changed files with 56 additions and 153 deletions

View File

@ -3,10 +3,9 @@ import { SnortSystemDb } from "@snort/system-web";
import { WorkerRelayInterface } from "@snort/worker-relay";
import WorkerRelayPath from "@snort/worker-relay/dist/worker?worker&url";
import { ChatCache } from "./ChatCache";
import { EventCacheWorker } from "./EventCacheWorker";
import { GiftWrapCache } from "./GiftWrapCache";
import { ProfileCacheRelayWorker } from "./ProfileWorkeCache";
import { ProfileCacheRelayWorker } from "./ProfileWorkerCache";
export const Relay = new WorkerRelayInterface(WorkerRelayPath);
export async function initRelayWorker() {
@ -24,13 +23,11 @@ export const RelayMetrics = new RelayMetricCache(SystemDb.relayMetrics);
export const UserCache = new ProfileCacheRelayWorker(Relay);
export const EventsCache = new EventCacheWorker(Relay);
export const Chats = new ChatCache();
export const GiftsCache = new GiftWrapCache();
export async function preload(follows?: Array<string>) {
const preloads = [
UserCache.preload(),
Chats.preload(),
RelayMetrics.preload(),
GiftsCache.preload(),
UserRelays.preload(follows),