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

Add support to max network concurrent requests #2129

Merged
merged 1 commit into from
Dec 5, 2016

Conversation

albertfdp
Copy link
Contributor

Summary

In my organization we are consuming many private dependencies as GitHub private repositories through ssh (i.e. git+ssh://[email protected]/org/name.git), which results that when the number of these dependencies exceeds some limit (around 10), the number of concurrent requests to GitHub from the same IP will result in a Connection reset by peer error which is a DoS protection from GitHub.

Fixes #1307

Since yarn will cache all successful fetches, it really does not matter that the first fetch of dependencies is a bit slow.

Let me know if concurrency is also the proper name, I'm thinking if I should use network-concurrency instead?

Test plan

Running yarn install --concurrency 1 on https://github.com/albertfdp/yarn-github-repos should not raise a Connection reset by peer error.

I've been looking into the tests at https://github.com/yarnpkg/yarn/blob/master/__tests__/util/request-manager.js but I'm not sure how to add a test to verify the concurrency. I'd be very happy to add a unit test if I can get some guidance.

Copy link
Member

@bestander bestander left a comment

Choose a reason for hiding this comment

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

needs a specific name

@@ -202,6 +203,7 @@ export default class Config {
cafile: String(opts.cafile || this.getOption('cafile') || ''),
cert: String(opts.cert || this.getOption('cert') || ''),
key: String(opts.key || this.getOption('key') || ''),
concurrency: Number(opts.concurrency || this.getOption('concurrency') || constants.NETWORK_CONCURRENCY),
Copy link
Member

Choose a reason for hiding this comment

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

we also have child concurrency, I think this option should be more specific to avoid confusion what kind of concurrency it is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've renamed it to network-concurrency, hope this is more specifc

@albertfdp albertfdp force-pushed the network-concurrency branch 2 times, most recently from 427ea8e to 6d1ff61 Compare December 4, 2016 19:06
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.

4 participants