summaryrefslogtreecommitdiff
path: root/packages/backend
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-19 11:19:42 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-19 11:19:42 +0900
commitec45db7870c0e157e9069bd2bceb1329c136a9fa (patch)
tree54e8913e136ed15aea8b9be92c306de476044359 /packages/backend
parentchore: disable debug log of fastify (diff)
downloadsharkey-ec45db7870c0e157e9069bd2bceb1329c136a9fa.tar.gz
sharkey-ec45db7870c0e157e9069bd2bceb1329c136a9fa.tar.bz2
sharkey-ec45db7870c0e157e9069bd2bceb1329c136a9fa.zip
refactor and perf tweak
Diffstat (limited to 'packages/backend')
-rw-r--r--packages/backend/src/core/ReactionService.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts
index f3f2b04dd6..4233b8d4c3 100644
--- a/packages/backend/src/core/ReactionService.ts
+++ b/packages/backend/src/core/ReactionService.ts
@@ -30,6 +30,7 @@ import { RoleService } from '@/core/RoleService.js';
import { FeaturedService } from '@/core/FeaturedService.js';
const FALLBACK = '❤';
+const PER_NOTE_REACTION_USER_PAIR_CACHE_MAX = 16;
const legacies: Record<string, string> = {
'like': '👍',
@@ -187,7 +188,7 @@ export class ReactionService {
await this.notesRepository.createQueryBuilder().update()
.set({
reactions: () => sql,
- ...(note.reactionAndUserPairCache.length < 10 ? {
+ ...(note.reactionAndUserPairCache.length < PER_NOTE_REACTION_USER_PAIR_CACHE_MAX ? {
reactionAndUserPairCache: () => `array_append("reactionAndUserPairCache", '${user.id}/${reaction}')`,
} : {}),
})