We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c2dbf6 commit 00d0be4Copy full SHA for 00d0be4
1 file changed
src/datasources/helpers/paginationQuery.ts
@@ -28,9 +28,10 @@ export const paginationDBHelper = async <
28
total: sql<number>`count(*)`,
29
}).from(subQuery);
30
31
- // TODO: Considerar parallelizar estas queries en un Promise.all
32
- const totalRecordsResult = await totalRecordsQuery.execute();
33
- const results = await query.limit(safePageSize).offset(offset).execute();
+ const [totalRecordsResult, results] = await Promise.all([
+ totalRecordsQuery.execute(),
+ query.limit(safePageSize).offset(offset).execute(),
34
+ ]);
35
36
const totalRecords = Number(totalRecordsResult[0].total);
37
const totalPages = Math.ceil(totalRecords / safePageSize);
0 commit comments