perf(server): Reduce database query
This commit is contained in:
@@ -8,7 +8,7 @@ import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '.
|
||||
import { toString } from '../../mfm/to-string';
|
||||
import { parse } from '../../mfm/parse';
|
||||
import { NoteReaction } from '../entities/note-reaction';
|
||||
import { populateEmojis } from '../../misc/populate-emojis';
|
||||
import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '../../misc/populate-emojis';
|
||||
|
||||
export type PackedNote = SchemaType<typeof packedNoteSchema>;
|
||||
|
||||
@@ -259,6 +259,8 @@ export class NoteRepository extends Repository<Note> {
|
||||
}
|
||||
}
|
||||
|
||||
await prefetchEmojis(aggregateNoteEmojis(notes));
|
||||
|
||||
return await Promise.all(notes.map(n => this.pack(n, me, {
|
||||
...options,
|
||||
_hint_: {
|
||||
|
Reference in New Issue
Block a user