summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-14 10:05:44 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-14 10:05:44 +0900
commit329830e2c3d1d46de712d1cbe4cf3bac51144dcb (patch)
tree38d6bcbf6a870d18510f751d331439c2d46625df
parentperf(backend): nyaizeを投稿時にやる (diff)
downloadsharkey-329830e2c3d1d46de712d1cbe4cf3bac51144dcb.tar.gz
sharkey-329830e2c3d1d46de712d1cbe4cf3bac51144dcb.tar.bz2
sharkey-329830e2c3d1d46de712d1cbe4cf3bac51144dcb.zip
perf(backend): tweak populateMyReaction
-rw-r--r--packages/backend/src/core/entities/NoteEntityService.ts8
1 files 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),