mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -07:00
perf(server): Reduce database query
This commit is contained in:
parent
c6fc5b2175
commit
1df6a3c8cc
1 changed files with 7 additions and 4 deletions
|
@ -594,10 +594,13 @@ function saveReply(reply: Note, note: Note) {
|
|||
}
|
||||
|
||||
function incNotesCountOfUser(user: User) {
|
||||
Users.increment({ id: user.id }, 'notesCount', 1);
|
||||
Users.update({ id: user.id }, {
|
||||
updatedAt: new Date()
|
||||
});
|
||||
Users.createQueryBuilder().update()
|
||||
.set({
|
||||
updatedAt: new Date(),
|
||||
notesCount: () => '"notesCount" + 1'
|
||||
})
|
||||
.where('id = :id', { id: user.id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
async function extractMentionedUsers(user: User, tokens: ReturnType<typeof parse>): Promise<User[]> {
|
||||
|
|
Loading…
Reference in a new issue