1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-05 02:08:14 +09:00

NoteEntityService の pack 内で CustomEmojiService の prefetchEmojis を呼ぶ (MisskeyIO#179)

streaming から Note の pack を行う際に populateEmojis から大量にクエリが飛ぶのを回避する

prefetchEmojis ではキャッシュ済みのものを除外しているため、packMany が呼ばれた場合でも大量にクエリが飛ぶことはない
This commit is contained in:
riku6460 2023-10-08 04:57:59 +09:00 committed by GitHub
parent 2b307bb3bb
commit 3bbac6f5d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,6 +324,7 @@ export class NoteEntityService implements OnModuleInit {
const reactionEmojiNames = Object.keys(note.reactions)
.filter(x => x.startsWith(':') && x.includes('@') && !x.includes('@.')) // リモートカスタム絵文字のみ
.map(x => this.reactionService.decodeReaction(x).reaction.replaceAll(':', ''));
await this.customEmojiService.prefetchEmojis(this.aggregateNoteEmojis([note]));
const packedFiles = options?._hint_?.packedFiles;
const packed: Packed<'Note'> = await awaitAll({