Merge pull request #22495 from hudsonb/queryEntities-perf-improvement

Minor perf improvement to queryEntities when limit=0
This commit is contained in:
Rickard Dybeck
2024-01-29 09:25:30 -05:00
committed by GitHub
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -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