refactor: remove event caches

This commit is contained in:
2024-01-08 11:33:33 +00:00
parent 08241bbbf6
commit 185aca0442
2 changed files with 0 additions and 45 deletions

View File

@ -4,19 +4,14 @@ import {
NostrEvent,
NostrSystem,
ProfileLoaderService,
ReqFilter,
socialGraphInstance,
TaggedNostrEvent,
} from "@snort/system";
import * as Comlink from "comlink";
import { RelayMetrics, SystemDb, UserCache, UserRelays } from "@/Cache";
import { addEventToFuzzySearch } from "@/Db/FuzzySearch";
import IndexedDBWorker from "@/Db/IndexedDB?worker";
import { LoginStore } from "@/Utils/Login";
import { hasWasm, WasmOptimizer } from "@/Utils/wasm";
export const indexedDB = Comlink.wrap(new IndexedDBWorker());
/**
* Singleton nostr system
*/
@ -39,30 +34,8 @@ System.on("auth", async (c, r, cb) => {
System.on("event", (_, ev) => {
addEventToFuzzySearch(ev);
socialGraphInstance.handleEvent(ev);
if (CONFIG.useIndexedDBEvents && socialGraphInstance.getFollowDistance(ev.pubkey) <= 2) {
indexedDB.handleEvent(ev);
}
});
System.on("request", (filter: ReqFilter) => {
if (CONFIG.useIndexedDBEvents) {
indexedDB.find(
filter,
Comlink.proxy((e: TaggedNostrEvent) => {
System.HandleEvent(e);
}),
);
}
});
if (CONFIG.useIndexedDBEvents) {
// load all profiles
indexedDB.find(
{ kinds: [0] },
Comlink.proxy((e: TaggedNostrEvent) => System.HandleEvent(e)),
);
}
/**
* Add profile loader fn
*/