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

Allow dynamically changing the concurrency #33

Open
sindresorhus opened this issue Feb 21, 2021 · 3 comments
Open

Allow dynamically changing the concurrency #33

sindresorhus opened this issue Feb 21, 2021 · 3 comments

Comments

@sindresorhus
Copy link
Owner

The idea was brought up in #28.

Not entirely sure what the best API would be for this though. Feedback welcome.

@Richienb
Copy link
Contributor

Richienb commented Jun 9, 2021

If mapper returns something like pMap.setConcurrency(5) then it should set the concurrency value in memory and then spin up more calls to next() as needed. Already running next() chains should check if they are not needed anymore at the start of each iteration:

const next = id => {
	if (concurrency < id) {
		return
	}

	// ...
}

@sindresorhus
Copy link
Owner Author

pMap.setConcurrency(5) would need to include the actual value too though.

@Richienb
Copy link
Contributor

Richienb commented Jun 9, 2021

Yes. It would work in a similar way to pMap.stop.

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

No branches or pull requests

2 participants