fix(gatsby-source-filesystem): Reduce default download concurrency to a saner value #28548
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.
Under the hood,
createRemoteFileNode
uses a Queue to process network requests. The number of concurrent workers for this queue is controlled by theGATSBY_CONCURRENT_DOWNLOAD
env variable.However, when the variable is not set, this defaults to 200. 200 is a very high number of concurrent HTTP connections to open to pretty much any remote and such load sustained over a few seconds typically results in the remote rate limiting us and not accepting any other connections after 40-50 of them.
It also results in timeouts, incomplete downloads etc which all result in extra retries required for most files.
10 is a much saner default and ensures consistent, stable downloads for most remotes.
A user may still choose to bump this up and may use the
GATSBY_CONCURRENT_DOWNLOAD
env var to do that. We are only changing the default so users without a opt in value can have a better default.