add profile events from db to fuzzy search
continuous-integration/drone/push Build is running Details

This commit is contained in:
Martti Malmi 2024-01-20 00:01:13 +02:00
parent 8fb127b347
commit 08bfd38563
2 changed files with 17 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import { initRelayWorker, preload, Relay } from "@/Cache";
import { ThreadRoute } from "@/Components/Event/Thread";
import { IntlProvider } from "@/Components/IntlProvider/IntlProvider";
import { db } from "@/Db";
import { addEventToFuzzySearch } from "@/Db/FuzzySearch";
import { updateRelayConnections } from "@/Hooks/useLoginRelays";
import { AboutPage } from "@/Pages/About";
import { SnortDeckLayout } from "@/Pages/DeckLayout";
@ -71,7 +72,20 @@ async function initSite() {
setupWebLNWalletConfig(Wallets);
Relay.sql("select json from events where kind = ?", [3]).then(res => {
for (const [json] of res) {
socialGraphInstance.handleEvent(JSON.parse(json as string));
try {
socialGraphInstance.handleEvent(JSON.parse(json as string));
} catch (e) {
console.error("Failed to handle contact list event from sql db", e);
}
}
});
Relay.sql("select json from events where kind = ?", [0]).then(res => {
for (const [json] of res) {
try {
addEventToFuzzySearch(JSON.parse(json as string));
} catch (e) {
console.error("Failed to handle metadata event from sql db", e);
}
}
});
return null;

View File

@ -3,6 +3,7 @@ import { mapEventToProfile, NostrEvent, NostrSystem, ProfileLoaderService, socia
import inMemoryDB from "@snort/system/src/InMemoryDB";
import { EventsCache, Relay, RelayMetrics, SystemDb, UserCache, UserRelays } from "@/Cache";
import { addEventToFuzzySearch } from "@/Db/FuzzySearch";
import { LoginStore } from "@/Utils/Login";
import { hasWasm, WasmOptimizer } from "@/Utils/wasm";
@ -32,6 +33,7 @@ System.on("event", (_, ev) => {
UserCache.discover(ev);
inMemoryDB.handleEvent(ev);
socialGraphInstance.handleEvent(ev);
addEventToFuzzySearch(ev);
});
/**