Skip to content

Commit

Permalink
Allow configuring CDN requests max concurrency to reduce flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
maikelvdh committed Aug 6, 2024
1 parent 7593a4c commit ec7ef6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion lib/cocoapods-core/cdn_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec7ef6f

Please sign in to comment.