From aebd77ad38583ee3a5d7e922435191b7d504339d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Mar 2022 15:44:49 +0900 Subject: [PATCH] perf(server): reduce db query --- packages/backend/src/remote/activitypub/db-resolver.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/remote/activitypub/db-resolver.ts b/packages/backend/src/remote/activitypub/db-resolver.ts index 9281e494d0..3f16c5f56d 100644 --- a/packages/backend/src/remote/activitypub/db-resolver.ts +++ b/packages/backend/src/remote/activitypub/db-resolver.ts @@ -78,14 +78,14 @@ export default class DbResolver { public async getAuthUserFromKeyId(keyId: string): Promise { const key = await UserPublickeys.findOne({ keyId, + }, { + relations: ['user'], }); if (key == null) return null; - const user = await Users.findOne(key.userId) as IRemoteUser; - return { - user, + user: key.user as IRemoteUser, key, }; }