From 52a45c308b00220ea8b3bf90fff2fc491c4a7c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 3 Apr 2026 23:05:02 +0200 Subject: [PATCH] Address review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move getOwnServiceCredentials() before the pagination loop in DefaultTechDocsCollatorFactory - Fix stale test comment that referenced the deleted MSW /entities handler Signed-off-by: Fredrik Adelöw Made-with: Cursor --- .../src/collators/DefaultTechDocsCollatorFactory.test.ts | 6 +++--- .../src/collators/DefaultTechDocsCollatorFactory.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.test.ts b/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.test.ts index cbddb1cadd..e7c0f01b2d 100644 --- a/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.test.ts +++ b/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.test.ts @@ -186,9 +186,9 @@ describe('DefaultTechDocsCollatorFactory', () => { }); it('paginates through catalog entities using batchSize', async () => { - // A parallelismLimit of 1 is a catalog limit of 50 per request. Code - // above in the /entities handler ensures valid entities are only - // returned on the second page. + // A parallelismLimit of 1 results in a batchSize of 50 per request. + // The catalog returns fewer entities than the batchSize, so the loop + // exits after a single page, producing 3 documents (1 entity × 3 search index docs). const _config = new ConfigReader({ ...config.get(), search: { diff --git a/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.ts b/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.ts index 06af1632d6..0c13aadbc6 100644 --- a/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.ts +++ b/plugins/search-backend-module-techdocs/src/collators/DefaultTechDocsCollatorFactory.ts @@ -143,9 +143,8 @@ export class DefaultTechDocsCollatorFactory implements DocumentCollatorFactory { // at index-time. The batchSize is calculated as a factor of the given // parallelism limit to simplify configuration. const batchSize = this.parallelismLimit * 50; + const credentials = await this.auth.getOwnServiceCredentials(); while (moreEntitiesToGet) { - const credentials = await this.auth.getOwnServiceCredentials(); - const entities = ( await this.catalog.getEntities( {