Skip to content

Commit

Permalink
chore: disable caches
Browse files Browse the repository at this point in the history
  • Loading branch information
v0l committed Dec 21, 2024
1 parent 609361d commit 1f0f45e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/Feed/LoginFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function useLoginFeed() {
const { publisher, system } = useEventPublisher();

useEffect(() => {
system.checkSigs = checkSigs;
//system.checkSigs = checkSigs;
}, [system, checkSigs]);

useEffect(() => {
Expand Down
14 changes: 4 additions & 10 deletions packages/app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import "./index.css";
import "@szhsin/react-menu/dist/index.css";
import "@/assets/fonts/inter.css";

import { unixNow, unixNowMs } from "@snort/shared";
import { unixNowMs } from "@snort/shared";
import { EventBuilder } from "@snort/system";
import { SnortContext } from "@snort/system-react";
import { StrictMode } from "react";
import * as ReactDOM from "react-dom/client";
import { createBrowserRouter, RouteObject, RouterProvider } from "react-router-dom";

import { initRelayWorker, preload, Relay, UserCache } from "@/Cache";
import { preload, UserCache } from "@/Cache";
import { ThreadRoute } from "@/Components/Event/Thread/ThreadRoute";
import { IntlProvider } from "@/Components/IntlProvider/IntlProvider";
import { db } from "@/Db";
import { addCachedMetadataToFuzzySearch } from "@/Db/FuzzySearch";
import { AboutPage } from "@/Pages/About";
import { DebugPage } from "@/Pages/CacheDebug";
Expand Down Expand Up @@ -40,7 +39,6 @@ import { WalletSendPage } from "@/Pages/wallet/send";
import ZapPoolPage from "@/Pages/ZapPool/ZapPool";
import { System } from "@/system";
import { storeRefCode, unwrap } from "@/Utils";
import { hasWasm, wasmInit, WasmPath } from "@/Utils/wasm";
import { Wallets } from "@/Wallet";
import { setupWebLNWalletConfig } from "@/Wallet";

Expand All @@ -54,14 +52,10 @@ async function initSite() {
"31990:84de35e2584d2b144aae823c9ed0b0f3deda09648530b93d1a2a146d1dea9864:app-profile",
];
storeRefCode();
if (hasWasm) {
await wasmInit(WasmPath);
await initRelayWorker();
}

setupWebLNWalletConfig(Wallets);

db.ready = await db.isAvailable();
//db.ready = await db.isAvailable();

const login = LoginStore.snapshot();
preload(login.state.follows).then(async () => {
Expand All @@ -84,7 +78,7 @@ async function initSite() {
});

// cleanup
Relay.delete(["REQ", "cleanup", { kinds: [1, 7, 9735], until: unixNow() - Day * 30 }]);
//Relay.delete(["REQ", "cleanup", { kinds: [1, 7, 9735], until: unixNow() - Day * 30 }]);

return null;
}
Expand Down
23 changes: 11 additions & 12 deletions packages/app/src/system.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { removeUndefined, throwIfOffline } from "@snort/shared";
import { mapEventToProfile, NostrEvent, NostrSystem } from "@snort/system";

import { EventsCache, Relay, RelayMetrics, SystemDb, UserCache, UserFollows, UserRelays } from "@/Cache";
import { addEventToFuzzySearch } from "@/Db/FuzzySearch";
import { LoginStore } from "@/Utils/Login";
import { hasWasm, WasmOptimizer } from "@/Utils/wasm";

/**
* Singleton nostr system
*/
export const System = new NostrSystem({
relays: UserRelays,
events: EventsCache,
profiles: UserCache,
relayMetrics: RelayMetrics,
cachingRelay: Relay,
contactLists: UserFollows,
optimizer: hasWasm ? WasmOptimizer : undefined,
db: SystemDb,
//relays: UserRelays,
//events: EventsCache,
//profiles: UserCache,
//relayMetrics: RelayMetrics,
//cachingRelay: Relay,
//contactLists: UserFollows,
//optimizer: hasWasm ? WasmOptimizer : undefined,
//db: SystemDb,
buildFollowGraph: true,
automaticOutboxModel: true,
checkSigs: false,
});

System.on("auth", async (c, r, cb) => {
Expand All @@ -31,8 +30,8 @@ System.on("auth", async (c, r, cb) => {
});

System.on("event", (_, ev) => {
EventsCache.discover(ev);
UserCache.discover(ev);
//EventsCache.discover(ev);
//UserCache.discover(ev);
addEventToFuzzySearch(ev);
});

Expand Down
10 changes: 9 additions & 1 deletion packages/worker-relay/src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { debugLog, setLogging } from "./debug";
import { EventMetadata, NostrEvent, OkResponse, ReqCommand, WorkerMessage, WorkerMessageCommand, unixNowMs } from "./types";
import {
EventMetadata,
NostrEvent,
OkResponse,
ReqCommand,
WorkerMessage,
WorkerMessageCommand,
unixNowMs,
} from "./types";
import { v4 as uuid } from "uuid";

export interface InitAargs {
Expand Down
2 changes: 1 addition & 1 deletion zapstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ snort:
artifacts:
- snort-arm64-v8a-v%v.apk
- snort-armeabi-v7a-v%v.apk
- snort-x86_64-v%v.apk
- snort-x86_64-v%v.apk

0 comments on commit 1f0f45e

Please sign in to comment.