diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-01 16:12:42 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-01 16:12:42 +0900 |
| commit | 5d683728f335b3759e492359f3cf33f727ed55ce (patch) | |
| tree | 3aa43f21445b74f0e901558a92740d6df3512784 | |
| parent | chore(ci): Renovateが作ったprにラベルつける (#15573) (diff) | |
| download | sharkey-5d683728f335b3759e492359f3cf33f727ed55ce.tar.gz sharkey-5d683728f335b3759e492359f3cf33f727ed55ce.tar.bz2 sharkey-5d683728f335b3759e492359f3cf33f727ed55ce.zip | |
デッドロック解消の試み (#15574)
https://github.com/misskey-dev/misskey/issues/15005
Co-authored-by: 饺子w (Yumechi) <35571479+eternal-flame-AD@users.noreply.github.com>
| -rw-r--r-- | packages/backend/src/core/activitypub/ApInboxService.ts | 11 | ||||
| -rw-r--r-- | packages/backend/src/core/activitypub/models/ApPersonService.ts | 6 |
2 files changed, 6 insertions, 11 deletions
diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts index 21c7adf7b2..e88f60b806 100644 --- a/packages/backend/src/core/activitypub/ApInboxService.ts +++ b/packages/backend/src/core/activitypub/ApInboxService.ts @@ -507,19 +507,12 @@ export class ApInboxService { return `skip: delete actor ${actor.uri} !== ${uri}`; } - const user = await this.usersRepository.findOneBy({ id: actor.id }); - if (user == null) { - return 'skip: actor not found'; - } else if (user.isDeleted) { - return 'skip: already deleted'; + if (!(await this.usersRepository.update({ id: actor.id, isDeleted: false }, { isDeleted: true })).affected) { + return 'skip: already deleted or actor not found'; } const job = await this.queueService.createDeleteAccountJob(actor); - await this.usersRepository.update(actor.id, { - isDeleted: true, - }); - this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: actor.id }); return `ok: queued ${job.name} ${job.id}`; diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 6019906add..879f1922ca 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -594,7 +594,9 @@ export class ApPersonService implements OnModuleInit { if (moving) updates.movedAt = new Date(); // Update user - await this.usersRepository.update(exist.id, updates); + if (!(await this.usersRepository.update({ id: exist.id, isDeleted: false }, updates)).affected) { + return 'skip'; + } if (person.publicKey) { await this.userPublickeysRepository.update({ userId: exist.id }, { @@ -699,7 +701,7 @@ export class ApPersonService implements OnModuleInit { @bindThis public async updateFeatured(userId: MiUser['id'], resolver?: Resolver): Promise<void> { - const user = await this.usersRepository.findOneByOrFail({ id: userId }); + const user = await this.usersRepository.findOneByOrFail({ id: userId, isDeleted: false }); if (!this.userEntityService.isRemoteUser(user)) return; if (!user.featured) return; |