Minor perf improvement to queryEntities when limit=0
Updates queryEntities to not execute dbQuery at all when limit is 0 Signed-off-by: Brian Hudson <brian.r.hudson@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Minor performance improvement for queryEntities when the limit is 0.
|
||||
@@ -451,7 +451,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog {
|
||||
countQuery.count('search.entity_id', { as: 'count' });
|
||||
|
||||
const [rows, [{ count }]] = await Promise.all([
|
||||
dbQuery,
|
||||
limit > 0 ? dbQuery : [],
|
||||
// for performance reasons we invoke the countQuery
|
||||
// only on the first request.
|
||||
// The result is then embedded into the cursor
|
||||
|
||||
Reference in New Issue
Block a user