mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[backend] Fix html cache dbFallback for user profiles
This commit is contained in:
parent
683e01d286
commit
2d475cb632
1 changed files with 2 additions and 2 deletions
|
@ -54,7 +54,7 @@ export class UserConverter {
|
||||||
: UserProfiles.findOneBy({ userId: u.id });
|
: UserProfiles.findOneBy({ userId: u.id });
|
||||||
const bio = this.userBioHtmlCache.fetch(identifier, async () => {
|
const bio = this.userBioHtmlCache.fetch(identifier, async () => {
|
||||||
return htmlCacheEntryLock.acquire(u.id, 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) {
|
if (htmlCacheEntry === null) {
|
||||||
return Promise.resolve(profile).then(async profile => {
|
return Promise.resolve(profile).then(async profile => {
|
||||||
return MfmHelpers.toHtml(mfm.parse(profile?.description ?? ""), profile?.mentions, u.host)
|
return MfmHelpers.toHtml(mfm.parse(profile?.description ?? ""), profile?.mentions, u.host)
|
||||||
|
@ -117,7 +117,7 @@ export class UserConverter {
|
||||||
const fields =
|
const fields =
|
||||||
this.userFieldsHtmlCache.fetch(identifier, async () => {
|
this.userFieldsHtmlCache.fetch(identifier, async () => {
|
||||||
return htmlCacheEntryLock.acquire(u.id, 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) {
|
if (htmlCacheEntry === null) {
|
||||||
return Promise.resolve(profile).then(profile => Promise.all(profile?.fields.map(async p => this.encodeField(p, u.host, profile?.mentions)) ?? []));
|
return Promise.resolve(profile).then(profile => Promise.all(profile?.fields.map(async p => this.encodeField(p, u.host, profile?.mentions)) ?? []));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue