From aea45f451de38c70ec7e51117242b771a20128f4 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Fri, 23 May 2025 05:04:13 +0000 Subject: [PATCH] fix(server): avoid infinite loop in manticoresearch (#12460) close CLOUD-221 ## Summary by CodeRabbit - **Bug Fixes** - Resolved an issue that could cause the document listing process to enter an infinite loop under certain conditions. --- packages/backend/server/src/plugins/indexer/service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/backend/server/src/plugins/indexer/service.ts b/packages/backend/server/src/plugins/indexer/service.ts index c1bbb4887..c231fbffa 100644 --- a/packages/backend/server/src/plugins/indexer/service.ts +++ b/packages/backend/server/src/plugins/indexer/service.ts @@ -191,6 +191,10 @@ export class IndexerService { }, }, }); + if (result.nextCursor && result.nextCursor === cursor) { + // NOTE(@fengmk2): avoid infinite loop bug in manticoresearch + break; + } docIds.push(...result.nodes.map(node => node.fields.docId[0] as string)); cursor = result.nextCursor; this.logger.debug(