Merge pull request #22495 from hudsonb/queryEntities-perf-improvement
Minor perf improvement to queryEntities when limit=0
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