Add support to max network concurrent requests #2129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aConnection 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 usenetwork-concurrency
instead?Test plan
Running
yarn install --concurrency 1
on https://github.com/albertfdp/yarn-github-repos should not raise aConnection 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.