Only backfill when cache has some values already
This commit is contained in:
parent
0eaf619721
commit
532ab8403d
@ -114,9 +114,11 @@ export class FollowsFeedCache extends RefreshFeedCache<TaggedNostrEvent> {
|
|||||||
async backFillIfMissing(system: SystemInterface, keys: Array<string>) {
|
async backFillIfMissing(system: SystemInterface, keys: Array<string>) {
|
||||||
const start = unixNowMs();
|
const start = unixNowMs();
|
||||||
const everything = await this.table?.toArray();
|
const everything = await this.table?.toArray();
|
||||||
const allKeys = new Set(everything?.map(a => a.pubkey));
|
if((everything?.length ?? 0) > 0) {
|
||||||
const missingKeys = keys.filter(a => !allKeys.has(a));
|
const allKeys = new Set(everything?.map(a => a.pubkey));
|
||||||
await this.backFill(system, missingKeys);
|
const missingKeys = keys.filter(a => !allKeys.has(a));
|
||||||
debug(this.name)(`Backfilled %d keys in %d ms`, missingKeys.length, (unixNowMs() - start).toLocaleString());
|
await this.backFill(system, missingKeys);
|
||||||
|
debug(this.name)(`Backfilled %d keys in %d ms`, missingKeys.length, (unixNowMs() - start).toLocaleString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user