diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-07-26 18:47:33 -0400 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2025-07-27 18:09:42 +0100 |
| commit | ec11092e8df36fd7f87f622e40ad1c49f5c34c97 (patch) | |
| tree | 9772593bda671a57f7e5da7cc85a8f01cf3c14da /packages/backend/src/core/CacheService.ts | |
| parent | fix users/report-abuse endpoint being really slow (diff) | |
| download | sharkey-ec11092e8df36fd7f87f622e40ad1c49f5c34c97.tar.gz sharkey-ec11092e8df36fd7f87f622e40ad1c49f5c34c97.tar.bz2 sharkey-ec11092e8df36fd7f87f622e40ad1c49f5c34c97.zip | |
fix cherry-pick error: restore CacheService.findOptionalUserById
Diffstat (limited to 'packages/backend/src/core/CacheService.ts')
| -rw-r--r-- | packages/backend/src/core/CacheService.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/backend/src/core/CacheService.ts b/packages/backend/src/core/CacheService.ts index 2d37cd6bab..84f6df3e21 100644 --- a/packages/backend/src/core/CacheService.ts +++ b/packages/backend/src/core/CacheService.ts @@ -351,6 +351,11 @@ export class CacheService implements OnApplicationShutdown { } @bindThis + public findOptionalUserById(userId: MiUser['id']) { + return this.userByIdCache.fetchMaybe(userId, async () => await this.usersRepository.findOneBy({ id: userId }) ?? undefined); + } + + @bindThis public async getFollowStats(userId: MiUser['id']): Promise<FollowStats> { return await this.userFollowStatsCache.fetch(userId, async () => { const stats = { |