mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-27 22:13:08 +02:00
perf(server): Reduce database query
This commit is contained in:
parent
a4a9b8707d
commit
fb194b855b
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