Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix: off-by-one bug in batch scrape pagination (#2492)

Himanshu Gupta76f777a383a8
diff --git a/apps/api/src/controllers/v1/crawl-status.ts b/apps/api/src/controllers/v1/crawl-status.ts
index 82eaddc9d..7bb1c7b46 100644
--- a/apps/api/src/controllers/v1/crawl-status.ts
+++ b/apps/api/src/controllers/v1/crawl-status.ts
@@ -232,7 +232,7 @@ export async function crawlStatusController(
const doneJobs = await scrapeQueue.getCrawlJobsForListing(
req.params.jobId,
- end !== undefined ? end - start : 100,
+ end !== undefined ? end - start + 1 : 100,
start,
logger.child({ zeroDataRetention }),
);
diff --git a/apps/api/src/controllers/v2/crawl-status.ts b/apps/api/src/controllers/v2/crawl-status.ts
index d6af4d726..077fb565f 100644
--- a/apps/api/src/controllers/v2/crawl-status.ts
+++ b/apps/api/src/controllers/v2/crawl-status.ts
@@ -252,7 +252,7 @@ export async function crawlStatusController(
const doneJobs = await scrapeQueue.getCrawlJobsForListing(
req.params.jobId,
- end !== undefined ? end - start : 100,
+ end !== undefined ? end - start + 1 : 100,
start,
logger.child({ zeroDataRetention }),
);