Skip to content

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

fix: handle edge case in getDoneJobsOrderedUntil function for Redis job retrieval

Ademílson Tonato51cee4246df6
diff --git a/apps/api/src/lib/crawl-redis.ts b/apps/api/src/lib/crawl-redis.ts
index e0b777d8a..aca73550e 100644
--- a/apps/api/src/lib/crawl-redis.ts
+++ b/apps/api/src/lib/crawl-redis.ts
@@ -217,10 +217,20 @@ export async function getDoneJobsOrderedUntil(
"crawl:" + id + ":jobs_donez_ordered",
24 * 60 * 60,
);
+ if (count === -1) {
+ return await redisEvictConnection.zrangebyscore(
+ "crawl:" + id + ":jobs_donez_ordered",
+ -Infinity,
+ until,
+ );
+ }
return await redisEvictConnection.zrangebyscore(
"crawl:" + id + ":jobs_donez_ordered",
-Infinity,
until,
+ "LIMIT",
+ start,
+ count,
);
}