mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-08 04:54:32 +00:00
use deliverMany to reduce overhead of account deletion queue
This commit is contained in:
parent
7ad772116b
commit
077096d04e
1 changed files with 3 additions and 10 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue