perf: Correctly parallelize count query in users.list
This commit is contained in:
@ -71,13 +71,13 @@ router.post("users.list", auth(), pagination(), async (ctx) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [users, total] = await Promise.all([
|
const [users, total] = await Promise.all([
|
||||||
await User.findAll({
|
User.findAll({
|
||||||
where,
|
where,
|
||||||
order: [[sort, direction]],
|
order: [[sort, direction]],
|
||||||
offset: ctx.state.pagination.offset,
|
offset: ctx.state.pagination.offset,
|
||||||
limit: ctx.state.pagination.limit,
|
limit: ctx.state.pagination.limit,
|
||||||
}),
|
}),
|
||||||
await User.count({
|
User.count({
|
||||||
where,
|
where,
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
Reference in New Issue
Block a user