From a4a9b8707d2d8100e3601679d479dd3b13e73c9a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 21 Mar 2021 21:27:49 +0900 Subject: [PATCH] perf(server): Reduce database query --- src/services/note/reaction/create.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index 897c816de..181099cc2 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -53,12 +53,11 @@ export default async (user: User, note: Note, reaction?: string) => { await Notes.createQueryBuilder().update() .set({ reactions: () => sql, + score: () => '"score" + 1' }) .where('id = :id', { id: note.id }) .execute(); - Notes.increment({ id: note.id }, 'score', 1); - perUserReactionsChart.update(user, note); // カスタム絵文字リアクションだったら絵文字情報も送る