-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolving more than 'X' URLs with capture-website, lacks concurrency for multiple promises #3
Comments
Resolved by using limited concurrency using const limit = pLimit(4); // allow 4 promises at once
promiseArr.push(limit(() => capture(bool, config)))
// where capture(bool, config) returns Promise<void> from captureWebsite
Promise.all(promiseArr).then(res => {
// image generated
}).catch(err => throw err)) |
Still not fixed, its not limiting correctly. For the number of posts in my I need to batch the captureWebsite calls because the limit() isnt limiting concurrency or I'm not implementing correctly. Images are being created and the plugin "is functional" but need to handle this concurrency issue. |
The above is referring to a possible EventEmitter memory leak, a leak occurs when you continuously add event handlers without removing them. This particularly happens when you use a single emitter instance numerous times.
|
I have a bunch of functions from |
I'm launching chrome processes in parallel. Every chrome instance adds a listener to the process's "exit" event to cleanup properly. 12 chrome instances add 12 listeners, which yields the warning. You can fix this by adding process.setMaxListeners(Infinity) in the very beginning of your script: |
Closing for a more succinct issue. |
Since the
capture-website
function is returning a Promise, when there are 10 are more URLs that are attempting to have screenshots taken, the following error occurs:I found the exact same issue over in
capture-website
, and they recommend using p-map.That looks promising because indeed I have 26 blog post articles in a collection that uses the
post.njk
layout, so at build time there are 26 templates being created for each post that uses thepost.njk
layout. Thus, 26input
s are being promised so 26Promise<void>
are being returned. Usingp-map
to map over promises concurrently should solve the issue.The text was updated successfully, but these errors were encountered: