MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnect listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit code example
Example: (node:14372) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added to [process]. Use emitter.setMaxListeners() to increase limit
const puppeteer = require('puppeteer')
const R = require('rambda')
process.setMaxListeners(Infinity);
const resolution = {
x : 1920,
y : 1080,
}
Note: you don't need to launch browser just to create a page. Instead, you can open multiple pages in the same browser:
const puppeteer = require('puppeteer')
const R = require('rambda')
const resolution = {
x : 1920,
y : 1080,
}
const args = [
'--disable-gpu',
`--window-size=${ resolution.x },${ resolution.y }`,
'--no-sandbox',
]
let browser;
const work = async () => {
const page = await browser.newPage()
const url = 'https://ilearnsmarter.com/learning-meme'
await page.setViewport({
width : resolution.x,
height : resolution.y,
})
await page.goto(url, { waitUntil : 'networkidle' })
await page.close();
}
const fn = async () => {
browser = await puppeteer.launch({
headless : true,
handleSIGINT : false,
args : args,
})
const promised = R.range(0, 12).map(() => work())
await Promise.all(promised)
browser.close()
console.log('DONE')
}
fn()