refactor: preload with follow list
This commit is contained in:
@ -68,8 +68,9 @@ export interface SystemInterface {
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
async Init() {
|
||||
async Init(follows?: Array<string>) {
|
||||
const t = [
|
||||
this.relayCache.preload(),
|
||||
this.profileCache.preload(),
|
||||
this.relayMetricsCache.preload(),
|
||||
this.eventsCache.preload(),
|
||||
this.userFollowsCache.preload(),
|
||||
this.relayCache.preload(follows),
|
||||
this.profileCache.preload(follows),
|
||||
this.relayMetricsCache.preload(follows),
|
||||
this.eventsCache.preload(follows),
|
||||
this.userFollowsCache.preload(follows),
|
||||
];
|
||||
await Promise.all(t);
|
||||
await this.PreloadSocialGraph();
|
||||
|
Reference in New Issue
Block a user