fix(crawl): make request 0 of crawl jobs higher priority
This commit is contained in:
@@ -139,6 +139,8 @@ export async function crawlController(req: Request, res: Response) {
|
|||||||
pageOptions: pageOptions,
|
pageOptions: pageOptions,
|
||||||
origin: req.body.origin ?? defaultOrigin,
|
origin: req.body.origin ?? defaultOrigin,
|
||||||
crawl_id: id,
|
crawl_id: id,
|
||||||
|
}, {
|
||||||
|
priority: 1, // prioritize request 0 of crawl jobs same as scrape jobs
|
||||||
});
|
});
|
||||||
await addCrawlJob(id, job.id);
|
await addCrawlJob(id, job.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ export async function addScrapeJob(
|
|||||||
jobId: string = uuidv4(),
|
jobId: string = uuidv4(),
|
||||||
): Promise<Job> {
|
): Promise<Job> {
|
||||||
return await getScrapeQueue().add(jobId, webScraperOptions, {
|
return await getScrapeQueue().add(jobId, webScraperOptions, {
|
||||||
|
priority: webScraperOptions.crawl_id ? 2 : 1,
|
||||||
...options,
|
...options,
|
||||||
jobId,
|
jobId,
|
||||||
priority: webScraperOptions.crawl_id ? 2 : 1,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user