sindresorhus / pageres

Capture website screenshots
MIT License
9.68k stars 744 forks source link

Add concurrency to image creation #404

Closed shannonrothe closed 3 years ago

shannonrothe commented 3 years ago

Noticed the comment so utilised Promise.all() to add concurrency to image creation 👍🏼

sindresorhus commented 3 years ago

I don't think Puppeteer can handle a load like this. I think you need to use https://github.com/sindresorhus/p-all with a concurrency of maybe "number of CPUs * 2". Needs to be tested what gives the output performance.

shannonrothe commented 3 years ago

@sindresorhus no problem, I might look into this a bit more when I get a chance 👍

sindresorhus commented 3 years ago

Friendly bump :)

shannonrothe commented 3 years ago

@sindresorhus still failing tests, not sure what the issue is with p-all 😕 Please check my changes and let me know how we can best approach 👍🏼

sindresorhus commented 3 years ago

You are using p-all incorrectly, which the error also points out.

sindresorhus commented 3 years ago

It might be better to use p-map since you're mapping this.sizes.

shannonrothe commented 3 years ago

It might be better to use p-map since you're mapping this.sizes.

Done, should be okay now 👌🏼

sindresorhus commented 3 years ago

Thanks :)