perf: Correctly parallelize count query in users.list

This commit is contained in:
Tom Moor
2021-07-30 12:14:32 -04:00
parent ed5320507d
commit 401c91f90b

View File

@ -71,13 +71,13 @@ router.post("users.list", auth(), pagination(), async (ctx) => {
}
const [users, total] = await Promise.all([
await User.findAll({
User.findAll({
where,
order: [[sort, direction]],
offset: ctx.state.pagination.offset,
limit: ctx.state.pagination.limit,
}),
await User.count({
User.count({
where,
}),
]);