This commit is contained in:
Nicolas
2024-08-21 22:53:33 -03:00
parent c7bfe4ffe8
commit 477c3257dc
4 changed files with 25 additions and 8 deletions
+10 -1
View File
@@ -144,6 +144,15 @@ export async function crawlController(req: Request, res: Response) {
: await crawler.tryGetSitemap();
if (sitemap !== null) {
let jobPriority = 20;
// If it is over 1000, we need to get the job priority,
// otherwise we can use the default priority of 20
if(sitemap.length > 1000){
// set base to 21
jobPriority = await getJobPriority({plan, team_id, basePriority: 21})
}
const jobs = sitemap.map((x) => {
const url = x.url;
const uuid = uuidv4();
@@ -161,7 +170,7 @@ export async function crawlController(req: Request, res: Response) {
},
opts: {
jobId: uuid,
priority: 20,
priority: jobPriority,
},
};
});