summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-08 19:52:59 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-09 11:02:51 -0400
commitfa68751a19877474bf78a80ef7204102296f0f17 (patch)
tree63d81dbc815f0d7c07a7f7effb51db026e1d8121 /packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
parentimplement userFollowersCache (diff)
downloadsharkey-fa68751a19877474bf78a80ef7204102296f0f17.tar.gz
sharkey-fa68751a19877474bf78a80ef7204102296f0f17.tar.bz2
sharkey-fa68751a19877474bf78a80ef7204102296f0f17.zip
normalize userFollowingsCache / userFollowersCache and add hibernatedUserCache to reduce the number of cache-clears and allow use of caching in many more places
Diffstat (limited to 'packages/backend/src/queue/processors/DeleteAccountProcessorService.ts')
-rw-r--r--packages/backend/src/queue/processors/DeleteAccountProcessorService.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
index 6a1a8bcc66..5bf64e4f04 100644
--- a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
+++ b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
@@ -18,6 +18,7 @@ import { SearchService } from '@/core/SearchService.js';
import { ApLogService } from '@/core/ApLogService.js';
import { ReactionService } from '@/core/ReactionService.js';
import { QueueService } from '@/core/QueueService.js';
+import { CacheService } from '@/core/CacheService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserDeleteJobData } from '../types.js';
@@ -94,6 +95,7 @@ export class DeleteAccountProcessorService {
private searchService: SearchService,
private reactionService: ReactionService,
private readonly apLogService: ApLogService,
+ private readonly cacheService: CacheService,
) {
this.logger = this.queueLoggerService.logger.createSubLogger('delete-account');
}
@@ -140,6 +142,22 @@ export class DeleteAccountProcessorService {
}
{ // Delete user relations
+ await this.cacheService.refreshFollowRelationsFor(user.id);
+ await this.cacheService.userFollowingsCache.delete(user.id);
+ await this.cacheService.userFollowingsCache.delete(user.id);
+ await this.cacheService.userBlockingCache.delete(user.id);
+ await this.cacheService.userBlockedCache.delete(user.id);
+ await this.cacheService.userMutingsCache.delete(user.id);
+ await this.cacheService.userMutingsCache.delete(user.id);
+ await this.cacheService.hibernatedUserCache.delete(user.id);
+ await this.cacheService.renoteMutingsCache.delete(user.id);
+ await this.cacheService.userProfileCache.delete(user.id);
+ this.cacheService.userByIdCache.delete(user.id);
+ this.cacheService.localUserByIdCache.delete(user.id);
+ if (user.token) {
+ this.cacheService.localUserByNativeTokenCache.delete(user.token);
+ }
+
await this.followingsRepository.delete({
followerId: user.id,
});