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

Allow configuring CDN requests max concurrency to reduce flakiness #773

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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