From 329830e2c3d1d46de712d1cbe4cf3bac51144dcb Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 14 Oct 2023 10:05:44 +0900
Subject: [PATCH] perf(backend): tweak populateMyReaction

---
 packages/backend/src/core/entities/NoteEntityService.ts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts
index 25132977f2..316367f23a 100644
--- a/packages/backend/src/core/entities/NoteEntityService.ts
+++ b/packages/backend/src/core/entities/NoteEntityService.ts
@@ -180,8 +180,8 @@ export class NoteEntityService implements OnModuleInit {
 		// 実装上抜けがあるだけかもしれないので、「ヒントに含まれてなかったら(=undefinedなら)return」のようにはしない
 		}
 
-		// パフォーマンスのためノートが作成されてから1秒以上経っていない場合はリアクションを取得しない
-		if (note.createdAt.getTime() + 1000 > Date.now()) {
+		// パフォーマンスのためノートが作成されてから2秒以上経っていない場合はリアクションを取得しない
+		if (note.createdAt.getTime() + 2000 > Date.now()) {
 			return undefined;
 		}
 
@@ -382,8 +382,8 @@ export class NoteEntityService implements OnModuleInit {
 		const myReactionsMap = new Map<MiNote['id'], MiNoteReaction | null>();
 		if (meId) {
 			const renoteIds = notes.filter(n => n.renoteId != null).map(n => n.renoteId!);
-			// パフォーマンスのためノートが作成されてから1秒以上経っていない場合はリアクションを取得しない
-			const targets = [...notes.filter(n => n.createdAt.getTime() + 1000 < Date.now()).map(n => n.id), ...renoteIds];
+			// パフォーマンスのためノートが作成されてから2秒以上経っていない場合はリアクションを取得しない
+			const targets = [...notes.filter(n => n.createdAt.getTime() + 2000 < Date.now()).map(n => n.id), ...renoteIds];
 			const myReactions = await this.noteReactionsRepository.findBy({
 				userId: meId,
 				noteId: In(targets),