From 0f635ec87736675e62a5e004485d69028d5fb61e Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 5 Sep 2023 15:26:04 +0100 Subject: [PATCH] Bugfix oldest --- packages/app/src/Cache/FollowsFeed.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/src/Cache/FollowsFeed.ts b/packages/app/src/Cache/FollowsFeed.ts index 2bd34f88..e01b466a 100644 --- a/packages/app/src/Cache/FollowsFeed.ts +++ b/packages/app/src/Cache/FollowsFeed.ts @@ -58,7 +58,7 @@ export class FollowsFeedCache extends RefreshFeedCache { .delete(); const oldest = await this.table?.orderBy("created_at").first(); - this.#oldest = oldest?.created_at ?? unixNow() - MaxCacheWindow; + this.#oldest = oldest?.created_at; this.notifyChange(latest?.map(a => this.key(a)) ?? []); debug(this.name)(`Loaded %d/%d in %d ms`, latest?.length ?? 0, keys.length, (unixNowMs() - start).toLocaleString()); @@ -112,6 +112,8 @@ export class FollowsFeedCache extends RefreshFeedCache { * Backfill cache based on follows list */ async backFillIfMissing(system: SystemInterface, keys: Array) { + if(!this.#oldest) return; + const start = unixNowMs(); const everything = await this.table?.toArray(); if ((everything?.length ?? 0) > 0) {