cocoapods-core 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec7ec4e495a2cbc2a01cbe258d3d2323da27af6ad5717e77aceee1f1d5463339
4
- data.tar.gz: 34a8fe7414bd94664f7258cc5c710e954b85a835cfb549c6902d50f2291ee6ae
3
+ metadata.gz: '02973d64419e7900d55429665eca2284ad9983f9ef5ad9c282b7705039ae961f'
4
+ data.tar.gz: da5f66b809e679357de6bbe1d3f1beceac415d9d27b05a258df5ac7f06b3bffe
5
5
  SHA512:
6
- metadata.gz: d8c1766e9efc229ef4381d832d0e6633a0cc348fa061ad326c5b8dc86babcb50965c9be560af1c72efce81bb7a4defe02cc2d6eb566029f0ce9144ab0d6f652d
7
- data.tar.gz: 5da4ee295ddacd8008a77c6431aabf71e759117f07630aa2a85bd2cec82674c7b7598ed1937c724cb2c145ef9d59d27d43b57968a0d2259c669f42d6608eba0d
6
+ metadata.gz: 9186ce5f1af5ae40103f3bb5606f9adf9f8aa66e2004b1ae68ccdfd88a05c6fd3474a1809f948831254662ed78d5fd9108a084730152bd3ed2209ffd081afae4
7
+ data.tar.gz: 75ac1c751ed37d42e2b6900a48f2a19f6f102f0c3954cd100359ab754ef3d7868f96f50c79402b30f9b9dad3f85963a5912f825dac49326686162919fac6164c
@@ -6,6 +6,9 @@ module Pod
6
6
  # Subclass of Pod::Source to provide support for CDN-based Specs repositories
7
7
  #
8
8
  class CDNSource < Source
9
+ MAX_CDN_NETWORK_THREADS = 50
10
+ MAX_NUMBER_OF_RETRIES = 5
11
+
9
12
  # @param [String] repo The name of the repository
10
13
  #
11
14
  def initialize(repo)
@@ -16,8 +19,8 @@ module Pod
16
19
  @startup_time = Time.new
17
20
 
18
21
  @executor = Concurrent::ThreadPoolExecutor.new(
19
- :min_threads => 1,
20
- :max_threads => 200,
22
+ :min_threads => 5,
23
+ :max_threads => (ENV['MAX_CDN_NETWORK_THREADS'] || MAX_CDN_NETWORK_THREADS).to_i,
21
24
  :max_queue => 0 # unbounded work queue
22
25
  )
23
26
 
@@ -54,11 +57,14 @@ module Pod
54
57
  def preheat_existing_files
55
58
  all_existing_files = [repo.join('**/*.yml'), repo.join('**/*.txt'), repo.join('**/*.json')].map(&Pathname.method(:glob)).flatten
56
59
  loaders = all_existing_files.map { |f| f.relative_path_from(repo).to_s }.map do |file|
57
- Concurrent::Promise.execute(:executor => @executor) do
60
+ Concurrent::Promises.future_on(@executor) do
58
61
  download_file(file)
59
62
  end
60
63
  end
61
- Concurrent::Promise.zip(*loaders).wait!
64
+
65
+ catching_concurrent_errors do
66
+ Concurrent::Promises.zip(*loaders).wait!
67
+ end
62
68
  end
63
69
 
64
70
  # @return [Pathname] The directory where the specs are stored.
@@ -104,7 +110,7 @@ module Pod
104
110
  # in #specification_path regardless.
105
111
  podspec_version_path_relative = Pathname.new(version).join("#{name}.podspec.json")
106
112
  unless pod_path_actual.join(podspec_version_path_relative).exist?
107
- loaders << Concurrent::Promise.execute(:executor => @executor) do
113
+ loaders << Concurrent::Promises.future_on(@executor) do
108
114
  download_file(pod_path_relative.join(podspec_version_path_relative).to_s)
109
115
  end
110
116
  end
@@ -113,10 +119,14 @@ module Pod
113
119
  rescue ArgumentError
114
120
  raise Informative, 'An unexpected version directory ' \
115
121
  "`#{version}` was encountered for the " \
116
- "`#{pod_dir}` Pod in the `#{name}` repository."
122
+ "`#{pod_path_actual}` Pod in the `#{name}` repository."
117
123
  end
118
124
  end.compact.sort.reverse
119
- Concurrent::Promise.zip(*loaders).wait!
125
+
126
+ catching_concurrent_errors do
127
+ Concurrent::Promises.zip(*loaders).wait!
128
+ end
129
+
120
130
  @versions_by_name[name]
121
131
  end
122
132
 
@@ -302,7 +312,7 @@ module Pod
302
312
  path = repo + partial_url
303
313
  etag_path = path.sub_ext(path.extname + '.etag')
304
314
 
305
- response = etag.nil? ? REST.get(file_remote_url) : REST.get(file_remote_url, 'If-None-Match' => etag)
315
+ response = download_retrying_connection_errors(partial_url, file_remote_url, etag)
306
316
 
307
317
  case response.status_code
308
318
  when 301
@@ -328,6 +338,17 @@ module Pod
328
338
  end
329
339
  end
330
340
 
341
+ def download_retrying_connection_errors(partial_url, file_remote_url, etag, retries = MAX_NUMBER_OF_RETRIES)
342
+ etag.nil? ? REST.get(file_remote_url) : REST.get(file_remote_url, 'If-None-Match' => etag)
343
+ rescue REST::Error => e
344
+ if retries <= 0
345
+ raise Informative, "CDN: #{name} Relative path couldn't be downloaded: #{partial_url}, error: #{e}"
346
+ else
347
+ debug "CDN: #{name} Relative path: #{partial_url} error: #{e} - retrying"
348
+ download_retrying_connection_errors(partial_url, file_remote_url, etag, retries - 1)
349
+ end
350
+ end
351
+
331
352
  def debug(message)
332
353
  if defined?(Pod::UI)
333
354
  Pod::UI.message(message)
@@ -335,5 +356,12 @@ module Pod
335
356
  CoreUI.puts(message)
336
357
  end
337
358
  end
359
+
360
+ def catching_concurrent_errors
361
+ yield
362
+ rescue Concurrent::MultipleErrors => e
363
+ errors = e.errors
364
+ raise Informative, "CDN: #{name} Repo update failed - #{e.errors.size} error(s):\n#{errors.join("\n")}"
365
+ end
338
366
  end
339
367
  end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.7.2'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.7.3'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-06-13 00:00:00.000000000 Z
12
+ date: 2019-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport