Skip to content
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

Fix concurrency control in pMapIterable #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmitri-gb
Copy link

Fixes #76

@sindresorhus
Copy link
Owner

// @Richienb

return;
}

const promise = (async () => {
pendingPromisesCount++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could be even more explicit by moving this up an additional level?

@Richienb
Copy link
Contributor

I think it would have taken me some hours to find this fix, so good spotting! 🎉

@Richienb
Copy link
Contributor

Richienb commented Aug 15, 2024

Your commit at dmitri-gb@8df3b16 reminded me that the reason why I initially incremented the count later was an attempt to avoid the exact issue it solved. It looks like a better solution would be to have two backpressures, one for function inputs and one for pending promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect pMapIterable behaviour
3 participants