diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3d3914..b54fd62a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ ##### Enhancements -* None. +* Add ability to configure max concurrency of CDN requests through environment variable. + [maikelvdh](https://github.com/maikelvdh) + [#773](https://github.com/CocoaPods/Core/pull/773) ##### Bug Fixes diff --git a/lib/cocoapods-core/cdn_source.rb b/lib/cocoapods-core/cdn_source.rb index a24cb9a0..9fefd591 100644 --- a/lib/cocoapods-core/cdn_source.rb +++ b/lib/cocoapods-core/cdn_source.rb @@ -10,6 +10,7 @@ module Pod class CDNSource < Source include Concurrent + MAX_CONCURRENCY = (ENV['COCOAPODS_CDN_MAX_CONCURRENCY'] || 200).to_i MAX_NUMBER_OF_RETRIES = (ENV['COCOAPODS_CDN_MAX_NUMBER_OF_RETRIES'] || 5).to_i # Single thread executor for all network activity. HYDRA_EXECUTOR = Concurrent::SingleThreadExecutor.new @@ -489,7 +490,7 @@ def concurrent_requests_catching_errors end def queue_request(request) - @hydra ||= Typhoeus::Hydra.new + @hydra ||= Typhoeus::Hydra.new(max_concurrency: MAX_CONCURRENCY) # Queue the request into the Hydra (libcurl reactor). @hydra.queue(request)