diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-06-06 02:15:31 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-09 11:02:36 -0400 |
| commit | 3d13860ec8fea79062ba0c498302cb19143e01f8 (patch) | |
| tree | 8a8036ebf1131383953ea2a179fe97998b2b13da /packages | |
| parent | use addMany instead of setMany when populating quantum caches from DB (diff) | |
| download | sharkey-3d13860ec8fea79062ba0c498302cb19143e01f8.tar.gz sharkey-3d13860ec8fea79062ba0c498302cb19143e01f8.tar.bz2 sharkey-3d13860ec8fea79062ba0c498302cb19143e01f8.zip | |
update quantum caches when a user is deleted
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/backend/src/core/CacheService.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/backend/src/core/CacheService.ts b/packages/backend/src/core/CacheService.ts index 00d97c7e1d..1fba4f32d0 100644 --- a/packages/backend/src/core/CacheService.ts +++ b/packages/backend/src/core/CacheService.ts @@ -138,7 +138,7 @@ export class CacheService implements OnApplicationShutdown { } @bindThis - private async onUserEvent<E extends 'userChangeSuspendedState' | 'userChangeDeletedState' | 'remoteUserUpdated' | 'localUserUpdated'>(body: InternalEventTypes[E]): Promise<void> { + private async onUserEvent<E extends 'userChangeSuspendedState' | 'userChangeDeletedState' | 'remoteUserUpdated' | 'localUserUpdated'>(body: InternalEventTypes[E], _: E, isLocal: boolean): Promise<void> { { { { @@ -151,6 +151,16 @@ export class CacheService implements OnApplicationShutdown { this.uriPersonCache.delete(k); } } + if (isLocal) { + await Promise.all([ + this.userProfileCache.delete(body.id), + this.userMutingsCache.delete(body.id), + this.userBlockingCache.delete(body.id), + this.userBlockedCache.delete(body.id), + this.renoteMutingsCache.delete(body.id), + this.userFollowingsCache.delete(body.id), + ]); + } } else { this.userByIdCache.set(user.id, user); for (const [k, v] of this.uriPersonCache.entries) { |