Skip to content

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

fix(crawl): make request 0 of crawl jobs higher priority

Gergő Móricz2ca1017fc354
diff --git a/apps/api/src/controllers/crawl.ts b/apps/api/src/controllers/crawl.ts
index f31e81f0c..40ceafa47 100644
--- a/apps/api/src/controllers/crawl.ts
+++ b/apps/api/src/controllers/crawl.ts
@@ -139,6 +139,8 @@ export async function crawlController(req: Request, res: Response) {
pageOptions: pageOptions,
origin: req.body.origin ?? defaultOrigin,
crawl_id: id,
+ }, {
+ priority: 1, // prioritize request 0 of crawl jobs same as scrape jobs
});
await addCrawlJob(id, job.id);
}
diff --git a/apps/api/src/services/queue-jobs.ts b/apps/api/src/services/queue-jobs.ts
index 5e679bfc3..0f0d2c99d 100644
--- a/apps/api/src/services/queue-jobs.ts
+++ b/apps/api/src/services/queue-jobs.ts
@@ -9,9 +9,9 @@ export async function addScrapeJob(
jobId: string = uuidv4(),
): Promise<Job> {
return await getScrapeQueue().add(jobId, webScraperOptions, {
+ priority: webScraperOptions.crawl_id ? 2 : 1,
...options,
jobId,
- priority: webScraperOptions.crawl_id ? 2 : 1,
});
}