heroku_hatchet 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb7387bbf480ee1443a1985b8bfd3681e6126605786c0ee102be9a691cd37f01
4
- data.tar.gz: 59876cc8324d6397434dbb03492a6d1231023c343aa6a70a61502cc5d8059fdc
3
+ metadata.gz: c8c96b7abf1268588dab46ad3ac1047df8420dd0835adb7414f05805526e1fb3
4
+ data.tar.gz: 0d68e35be7b4bbd23e2d48ee6dc0a178e90a90230bebf88354672011788988bf
5
5
  SHA512:
6
- metadata.gz: 95998e8ab947245d1ebc799fd6bf54b377bffda5e4b63f608aa2663e55e278d71d307754a6d2a623e66e8ff07dcbd04d1b30f4d3ab666b5b1e9856b78f22e645
7
- data.tar.gz: 7554ca9897c18aa4022526a5e9deba8f05475797f57b5635dc51658797c92390556ea12fcdc66bad6567cbf8a3fb3ab72ae1408d41345bba95fe0d904f2851df
6
+ metadata.gz: c4eaf334f446527a1d16904f5e6e61649bfeca7999b0b6e20f099795527f8db0c473700a0e5df393a016ca2e98cb1ab1514e01c58860241cedbb9625f1c31e20
7
+ data.tar.gz: 5edd405fe8bb11ab24dc0384655f05140033f5367d6e57836ac35f29f52d10b6dda3f90a0cd1a8123ce112f346b776e7026fae70d0c557d6190a0610df62e64d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 4.0.1
4
+
5
+ - Rate limit Heroku CI
6
+
3
7
  ## 4.0.0
4
8
 
5
9
  - Introduce API rate limiting (#46)
@@ -23,7 +23,7 @@ class ApiRateLimit
23
23
  # Unfortunatley `@platform_api.rate_limit` is an extra API
24
24
  # call, so by checking our limit, we also are using our limit 😬
25
25
  # to partially mitigate this, only check capacity every 5
26
- # api calls, or if the
26
+ # api calls, or if the current capacity is under 1000
27
27
  def call
28
28
  @called += 1
29
29
 
data/lib/hatchet/app.rb CHANGED
@@ -236,11 +236,14 @@ module Hatchet
236
236
 
237
237
  # create_app
238
238
  # platform_api.pipeline_coupling.create(app: name, pipeline: @pipeline_id, stage: "development")
239
- test_run = TestRun.new(token: api_key,
240
- buildpacks: @buildpacks,
241
- timeout: timeout,
242
- app: self,
243
- pipeline: @pipeline_id)
239
+ test_run = TestRun.new(
240
+ token: api_key,
241
+ buildpacks: @buildpacks,
242
+ timeout: timeout,
243
+ app: self,
244
+ pipeline: @pipeline_id,
245
+ api_rate_limit: api_rate_limit
246
+ )
244
247
 
245
248
  Hatchet::RETRIES.times.retry do
246
249
  test_run.create_test_run
@@ -22,6 +22,7 @@ module Hatchet
22
22
  buildpacks:,
23
23
  app:,
24
24
  pipeline:,
25
+ api_rate_limit:,
25
26
  timeout: 10,
26
27
  pause: 5,
27
28
  commit_sha: "sha",
@@ -41,6 +42,7 @@ module Hatchet
41
42
  @app = app
42
43
  @mutex = Mutex.new
43
44
  @status = false
45
+ @api_rate_limit = api_rate_limit
44
46
  end
45
47
  attr_reader :app
46
48
 
@@ -164,6 +166,7 @@ module Hatchet
164
166
 
165
167
  source_put_url = @app.create_source
166
168
  Hatchet::RETRIES.times.retry do
169
+ @api_rate_limit.call
167
170
  Excon.put(source_put_url,
168
171
  expects: [200],
169
172
  body: File.read('slug.tgz'))
@@ -174,6 +177,7 @@ module Hatchet
174
177
 
175
178
  private
176
179
  def get_contents_or_whatever(url)
180
+ @api_rate_limit.call
177
181
  Excon.get(url, read_timeout: @pause).body
178
182
  rescue Excon::Error::Timeout
179
183
  ""
@@ -197,6 +201,7 @@ module Hatchet
197
201
  options[:body] = JSON.generate(options[:body]) if options[:body]
198
202
 
199
203
  Hatchet::RETRIES.times.retry do
204
+ @api_rate_limit.call
200
205
  connection = Excon.new("https://api.heroku.com")
201
206
  return connection.request(options)
202
207
  end
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_hatchet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-25 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: platform-api