refactor: preload with follow list
This commit is contained in:
parent
670898c016
commit
5e1af603b7
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@snort/shared",
|
"name": "@snort/shared",
|
||||||
"version": "1.0.13",
|
"version": "1.0.14",
|
||||||
"description": "Shared components for Snort",
|
"description": "Shared components for Snort",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"module": "src/index.ts",
|
"module": "src/index.ts",
|
||||||
|
@ -15,7 +15,7 @@ export interface CacheEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type CachedTable<T> = {
|
export type CachedTable<T> = {
|
||||||
preload(): Promise<void>;
|
preload(follows?: Array<string>): Promise<void>;
|
||||||
keysOnTable(): Array<string>;
|
keysOnTable(): Array<string>;
|
||||||
getFromCache(key?: string): T | undefined;
|
getFromCache(key?: string): T | undefined;
|
||||||
get(key?: string): Promise<T | undefined>;
|
get(key?: string): Promise<T | undefined>;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@snort/system-react",
|
"name": "@snort/system-react",
|
||||||
"version": "1.2.10",
|
"version": "1.2.11",
|
||||||
"description": "React hooks for @snort/system",
|
"description": "React hooks for @snort/system",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "src/index.ts",
|
"module": "src/index.ts",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@snort/shared": "^1.0.13",
|
"@snort/shared": "^1.0.14",
|
||||||
"@snort/system": "^1.2.10",
|
"@snort/system": "^1.2.11",
|
||||||
"react": "^18.2.0"
|
"react": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@snort/system-web",
|
"name": "@snort/system-web",
|
||||||
"version": "1.2.10",
|
"version": "1.2.11",
|
||||||
"description": "Web based components @snort/system",
|
"description": "Web based components @snort/system",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@snort/shared": "^1.0.13",
|
"@snort/shared": "^1.0.14",
|
||||||
"@snort/system": "^1.2.10",
|
"@snort/system": "^1.2.11",
|
||||||
"dexie": "^3.2.4"
|
"dexie": "^3.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@snort/system",
|
"name": "@snort/system",
|
||||||
"version": "1.2.10",
|
"version": "1.2.11",
|
||||||
"description": "Snort nostr system package",
|
"description": "Snort nostr system package",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"@noble/curves": "^1.2.0",
|
"@noble/curves": "^1.2.0",
|
||||||
"@noble/hashes": "^1.3.2",
|
"@noble/hashes": "^1.3.2",
|
||||||
"@scure/base": "^1.1.2",
|
"@scure/base": "^1.1.2",
|
||||||
"@snort/shared": "^1.0.13",
|
"@snort/shared": "^1.0.14",
|
||||||
"@stablelib/xchacha20": "^1.0.1",
|
"@stablelib/xchacha20": "^1.0.1",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"eventemitter3": "^5.0.1",
|
"eventemitter3": "^5.0.1",
|
||||||
|
@ -68,8 +68,9 @@ export interface SystemInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Do some initialization
|
* Do some initialization
|
||||||
|
* @param follows A follower list to preload content for
|
||||||
*/
|
*/
|
||||||
Init(): Promise<void>;
|
Init(follows?: Array<string>): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an active query by ID
|
* Get an active query by ID
|
||||||
|
@ -269,13 +269,13 @@ export class NostrSystem extends EventEmitter<NostrSystemEvents> implements Syst
|
|||||||
this.#queryManager.on("request", (subId: string, f: BuiltRawReqFilter) => this.emit("request", subId, f));
|
this.#queryManager.on("request", (subId: string, f: BuiltRawReqFilter) => this.emit("request", subId, f));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Init() {
|
async Init(follows?: Array<string>) {
|
||||||
const t = [
|
const t = [
|
||||||
this.relayCache.preload(),
|
this.relayCache.preload(follows),
|
||||||
this.profileCache.preload(),
|
this.profileCache.preload(follows),
|
||||||
this.relayMetricsCache.preload(),
|
this.relayMetricsCache.preload(follows),
|
||||||
this.eventsCache.preload(),
|
this.eventsCache.preload(follows),
|
||||||
this.userFollowsCache.preload(),
|
this.userFollowsCache.preload(follows),
|
||||||
];
|
];
|
||||||
await Promise.all(t);
|
await Promise.all(t);
|
||||||
await this.PreloadSocialGraph();
|
await this.PreloadSocialGraph();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user