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