From 2d475cb63249819b8b1756c0ae8dabe66636441d Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Mon, 27 Nov 2023 14:36:40 +0100 Subject: [PATCH] [backend] Fix html cache dbFallback for user profiles --- packages/backend/src/server/api/mastodon/converters/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/converters/user.ts b/packages/backend/src/server/api/mastodon/converters/user.ts index 5ea97d2ec..54f9568db 100644 --- a/packages/backend/src/server/api/mastodon/converters/user.ts +++ b/packages/backend/src/server/api/mastodon/converters/user.ts @@ -54,7 +54,7 @@ export class UserConverter { : UserProfiles.findOneBy({ userId: u.id }); const bio = this.userBioHtmlCache.fetch(identifier, async () => { return htmlCacheEntryLock.acquire(u.id, async () => { - if (htmlCacheEntry === undefined) await this.fetchFromCacheWithFallback(u, await profile, ctx); + if (htmlCacheEntry === undefined) htmlCacheEntry = await this.fetchFromCacheWithFallback(u, await profile, ctx); if (htmlCacheEntry === null) { return Promise.resolve(profile).then(async profile => { return MfmHelpers.toHtml(mfm.parse(profile?.description ?? ""), profile?.mentions, u.host) @@ -117,7 +117,7 @@ export class UserConverter { const fields = this.userFieldsHtmlCache.fetch(identifier, async () => { return htmlCacheEntryLock.acquire(u.id, async () => { - if (htmlCacheEntry === undefined) await this.fetchFromCacheWithFallback(u, await profile, ctx); + if (htmlCacheEntry === undefined) htmlCacheEntry = await this.fetchFromCacheWithFallback(u, await profile, ctx); if (htmlCacheEntry === null) { return Promise.resolve(profile).then(profile => Promise.all(profile?.fields.map(async p => this.encodeField(p, u.host, profile?.mentions)) ?? [])); }