Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
¿Cómo manejar solicitudes concurrentes con Puppeteer?

Tengo un problema con la pérdida de memoria de EventEmitter detectada

Tengo una función que inicia el navegador así.

 async function startBrowser() { const revisionInfo = await browserFetcher.download("901912"); const browser = await puppeteer.launch({ executablePath: revisionInfo.executablePath, args: [ "--no-sandbox", "--disable-gpu", "--disable-dev-shm-usage", "--disable-setuid-sandbox", "--no-first-run", "--no-zygote", "--single-process", ], }); const page = await browser.newPage(); return { browser, page }; }

Una de mis funciones se asigna a través de una cantidad de elementos como

 const work = (stuff) => { const workTodo = stuff.map(item = { setTimeout(() => { anotherFunction(some params) }, some time variable all different seconds } await Promise.all(workTodo); }

y en otra función()

 anotherFunction(someParams) { const { browser, page } = await startBrowser(); try { await browser.newPage(); await page.goto('stuff'); await page.waitForSelector('stuff'); await page.click('stuff'); await page.close(); await browser.close(); } catch (error) { console.log('error', error); return }

La lógica en anotherFunction() funciona alrededor del 70-80 % del tiempo, pero a veces se excede el tiempo de espera en las llamadas a waitForSelector y, a veces, se producen errores de pérdida de memoria.

¿Estoy creando demasiados navegadores? y no cierra bien?

¿Alguien que sepa titiritero me puede decir que estoy haciendo mal?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!