Skip to content

Commit b947251

Browse files
harikakondurclaude
andcommitted
fix(link-checker): switch entry pagination to cursor-based to bypass 10k CMA limit [ES-524]
The Contentful CMA enforces a hard cap of skip+limit<=10000. With ENTRY_FETCH_LIMIT=100 this meant the fetching loop silently stopped after 100 pages (10000 entries), which for the customer space translated to ~14,670 links found. Replace skip-based pagination with sys.id[gt] cursor pagination (ordered by sys.id) which has no upper bound. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c620a8a commit b947251

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/link-checker/components/locations/Page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,23 @@ export default function Page() {
318318
const resultMap = new Map<string, PageLinkResult>();
319319
const checksToQueue: typeof pendingChecks = [];
320320

321-
let skip = 0;
321+
let lastSeenId: string | undefined;
322322
let hasLoadedFirstBatch = false;
323323
let entriesScanned = 0;
324324
let linksFound = 0;
325325
const entryQueryBase = {
326326
'sys.contentType.sys.id[in]': Array.from(contentTypeMap.keys()).join(','),
327+
order: 'sys.id',
327328
};
328329

329330
while (true) {
330331
const response = await sdk.cma.entry.getMany({
331332
spaceId: sdk.ids.space,
332333
environmentId: sdk.ids.environment,
333334
query: {
334-
skip,
335335
limit: ENTRY_FETCH_LIMIT,
336336
...entryQueryBase,
337+
...(lastSeenId ? { 'sys.id[gt]': lastSeenId } : {}),
337338
},
338339
});
339340

@@ -461,7 +462,7 @@ export default function Page() {
461462
break;
462463
}
463464

464-
skip += ENTRY_FETCH_LIMIT;
465+
lastSeenId = batchEntries[batchEntries.length - 1].sys.id;
465466
}
466467

467468
if (!hasLoadedFirstBatch) {

0 commit comments

Comments
 (0)