Skip to content

Commit

Permalink
fix: limit relations amount
Browse files Browse the repository at this point in the history
  • Loading branch information
dweber019 committed Sep 2, 2024
1 parent 6960054 commit 0d09496
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-terms-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dweber019/backstage-plugin-missing-entity-backend': patch
---

Limit amount of relations per entity to 1000.
6 changes: 6 additions & 0 deletions plugins/missing-entity-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ The default setup will only check missing entities once when processed.
If you want this process to also refresh the data you can do so by adding the `age`.
It's recommended that if you choose to use this configuration to set it to 3 to update stale data.
## Limitations
### Relation limit
Currently, we only process the first 1000 relation per entity.
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ export class MissingEntityBackendClient implements MissingEntityBackendApi {
entityRefRelations?.length > 1
) {
const relatedEntities = await this.catalogApi.getEntitiesByRefs({
entityRefs: entityRefRelations,
entityRefs: entityRefRelations.slice(0, 1000),
fields: ['kind', 'metadata.name', 'metadata.namespace'],
}, { token });

entityResults.missingEntityRefs = entityRefRelations.filter(
entityResults.missingEntityRefs = entityRefRelations.slice(0, 1000).filter(
(_, index) => relatedEntities.items[index] === undefined,
);
}
Expand Down

0 comments on commit 0d09496

Please sign in to comment.