From ec7ef6f41ce6cf325ba74aa064840d6eaedc2952 Mon Sep 17 00:00:00 2001 From: Maikel van den Hurk Date: Tue, 6 Aug 2024 08:31:29 +0200 Subject: [PATCH 1/2] Allow configuring CDN requests max concurrency to reduce flakiness --- CHANGELOG.md | 4 +++- lib/cocoapods-core/cdn_source.rb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) 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) From 6ca8ccec2f97bed4a0014029cc897669ce3f7408 Mon Sep 17 00:00:00 2001 From: Maikel van den Hurk Date: Thu, 8 Aug 2024 08:17:46 +0200 Subject: [PATCH 2/2] chore(style): address rubocop hashsyntax usage --- lib/cocoapods-core/cdn_source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-core/cdn_source.rb b/lib/cocoapods-core/cdn_source.rb index 9fefd591..f66764a3 100644 --- a/lib/cocoapods-core/cdn_source.rb +++ b/lib/cocoapods-core/cdn_source.rb @@ -490,7 +490,7 @@ def concurrent_requests_catching_errors end def queue_request(request) - @hydra ||= Typhoeus::Hydra.new(max_concurrency: MAX_CONCURRENCY) + @hydra ||= Typhoeus::Hydra.new(:max_concurrency => MAX_CONCURRENCY) # Queue the request into the Hydra (libcurl reactor). @hydra.queue(request)