fix(crawl-redis/addCrawlJobDone): further ensure that completed doesn't go over total
This commit is contained in:
@@ -92,12 +92,16 @@ export async function addCrawlJobDone(
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
await redisConnection.rpush("crawl:" + id + ":jobs_done_ordered", job_id);
|
await redisConnection.rpush("crawl:" + id + ":jobs_done_ordered", job_id);
|
||||||
await redisConnection.expire(
|
} else {
|
||||||
"crawl:" + id + ":jobs_done_ordered",
|
// in case it's already been pushed, make sure it's removed
|
||||||
24 * 60 * 60,
|
await redisConnection.lrem("crawl:" + id + ":jobs_done_ordered", -1, job_id);
|
||||||
"NX",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await redisConnection.expire(
|
||||||
|
"crawl:" + id + ":jobs_done_ordered",
|
||||||
|
24 * 60 * 60,
|
||||||
|
"NX",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDoneJobsOrderedLength(id: string): Promise<number> {
|
export async function getDoneJobsOrderedLength(id: string): Promise<number> {
|
||||||
|
|||||||
Reference in New Issue
Block a user