summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-12 15:42:39 +0000
committerHazelnoot <acomputerdog@gmail.com>2025-06-12 15:42:39 +0000
commit55551a5a8a3a218b9f56491f2dbe3f70e3ef3556 (patch)
tree927f789e18162a91da0144356d040995864613ee /packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
parentmerge: Enforce DM visibility in generateVisibilityQuery (!1108) (diff)
parentfix relations in MastodonDataService.ts (diff)
downloadsharkey-55551a5a8a3a218b9f56491f2dbe3f70e3ef3556.tar.gz
sharkey-55551a5a8a3a218b9f56491f2dbe3f70e3ef3556.tar.bz2
sharkey-55551a5a8a3a218b9f56491f2dbe3f70e3ef3556.zip
merge: Avoid more N+1 queries in NoteEntityService and UserEntityService (!1099)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1099 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
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,
});