use deliverMany to reduce overhead of account deletion queue
This commit is contained in:
@@ -63,8 +63,6 @@ export class DeleteAccountService {
|
|||||||
// 知り得る全SharedInboxにDelete配信
|
// 知り得る全SharedInboxにDelete配信
|
||||||
const content = this.apRendererService.addContext(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user));
|
const content = this.apRendererService.addContext(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user));
|
||||||
|
|
||||||
const queue: string[] = [];
|
|
||||||
|
|
||||||
const followings = await this.followingsRepository.find({
|
const followings = await this.followingsRepository.find({
|
||||||
where: [
|
where: [
|
||||||
{ followerSharedInbox: Not(IsNull()) },
|
{ followerSharedInbox: Not(IsNull()) },
|
||||||
@@ -73,15 +71,10 @@ export class DeleteAccountService {
|
|||||||
select: ['followerSharedInbox', 'followeeSharedInbox'],
|
select: ['followerSharedInbox', 'followeeSharedInbox'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const inboxes = followings.map(x => x.followerSharedInbox ?? x.followeeSharedInbox);
|
const inboxes = followings.map(x => [x.followerSharedInbox ?? x.followeeSharedInbox as string, true] as const);
|
||||||
|
const queue = new Map<string, true>(inboxes);
|
||||||
|
|
||||||
for (const inbox of inboxes) {
|
await this.queueService.deliverMany(user, content, queue);
|
||||||
if (inbox != null && !queue.includes(inbox)) queue.push(inbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const inbox of queue) {
|
|
||||||
this.queueService.deliver(user, content, inbox, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queueService.createDeleteAccountJob(user, {
|
this.queueService.createDeleteAccountJob(user, {
|
||||||
soft: false,
|
soft: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user