Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix(crawl-redis/addCrawlJobDone): further ensure that completed doesn't go over total
Gergő Móricz98f27b0acc19
diff --git a/apps/api/src/lib/crawl-redis.ts b/apps/api/src/lib/crawl-redis.tsindex 3fcd9f678..0c9e0ff0d 100644--- a/apps/api/src/lib/crawl-redis.ts+++ b/apps/api/src/lib/crawl-redis.ts@@ -92,12 +92,16 @@ export async function addCrawlJobDone(if (success) {await redisConnection.rpush("crawl:" + id + ":jobs_done_ordered", job_id);- await redisConnection.expire(- "crawl:" + id + ":jobs_done_ordered",- 24 * 60 * 60,- "NX",- );+ } else {+ // in case it's already been pushed, make sure it's removed+ await redisConnection.lrem("crawl:" + id + ":jobs_done_ordered", -1, job_id);}++ await redisConnection.expire(+ "crawl:" + id + ":jobs_done_ordered",+ 24 * 60 * 60,+ "NX",+ );}export async function getDoneJobsOrderedLength(id: string): Promise<number> {