fix(v1/batch/scrape): horrid memory usage

This commit is contained in:
Gergő Móricz 2024-12-05 20:49:28 +01:00
parent f8e619b5df
commit cce94289ee

View File

@ -59,6 +59,10 @@ export async function batchScrapeController(
jobPriority = await getJobPriority({plan: req.auth.plan, team_id: req.auth.team_id, basePriority: 21}) jobPriority = await getJobPriority({plan: req.auth.plan, team_id: req.auth.team_id, basePriority: 21})
} }
const scrapeOptions: ScrapeOptions = { ...req.body };
delete (scrapeOptions as any).urls;
delete (scrapeOptions as any).appendToId;
const jobs = req.body.urls.map((x) => { const jobs = req.body.urls.map((x) => {
return { return {
data: { data: {
@ -67,7 +71,7 @@ export async function batchScrapeController(
team_id: req.auth.team_id, team_id: req.auth.team_id,
plan: req.auth.plan!, plan: req.auth.plan!,
crawlerOptions: null, crawlerOptions: null,
scrapeOptions: req.body, scrapeOptions,
origin: "api", origin: "api",
crawl_id: id, crawl_id: id,
sitemapped: true, sitemapped: true,