kennel 2.16.1 → 2.17.0

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: 0b08ac7b025cd269d90dfdbf626462369014382d98a4dde07511ed859bbbf127
4
- data.tar.gz: 1d86dbf258a8fcb2e7ccc789d18d3657b53a4f6bd47c156502dec42f800265d5
3
+ metadata.gz: 0b10275d6b15d9bf4d1355b3584f5f90cfe28ca4101ca4af5bd8c1ca5d1a9d59
4
+ data.tar.gz: b9125231abbe0093fd6fd3aa3a87020617876ca44dfb362d9fcb75330012d915
5
5
  SHA512:
6
- metadata.gz: 10df3bd50427d69a6c79f0eeec46b9f3ab485bc18d08e17705ac8f690b8fed0ea1d56c7070db8c1fa2d7cda7670567eb515d6f339eb623aa58c2f85d41682428
7
- data.tar.gz: 8811cfd7784d30df4a73b25af1c968f7b2372fcfaf8dded09e51fc26c6c72b80ea7498dcf0e08eea2192750ddd9b2051983a4d66fa2663e25964301be6b90ef4
6
+ metadata.gz: 299cd89f0f8e03a018dddec6e29090a3a1559e24df39217ca555b0634a2e45a4a357dca297f19199c80040db59d6db558da789b7b4f063235210ea902224c432
7
+ data.tar.gz: 9290b593a9cf074cc51621cd47acdaf80487e7e00a88422a3e9096399fc98fa58e39738ea0fc7a96f28a74056e564e7dad31fd91c3317dda48eb056b0cf90be2
data/lib/kennel/api.rb CHANGED
@@ -107,7 +107,7 @@ module Kennel
107
107
  cache.open(&block)
108
108
  end
109
109
 
110
- def request(method, path, body: nil, params: {}, ignore_404: false, tries: 3)
110
+ def request(method, path, body: nil, params: {}, ignore_404: false, tries: 5)
111
111
  path = "#{path}?#{Faraday::FlatParamsEncoder.encode(params)}" if params.any?
112
112
  cached = (ENV["FORCE_GET_CACHE"] && method == :get)
113
113
 
@@ -131,6 +131,7 @@ module Kennel
131
131
  last_try = (i == tries - 1)
132
132
  break if last_try || ![:get, :put].include?(method) || response.status < 500
133
133
  Kennel.err.puts "Retrying on server error #{response.status} for #{path}"
134
+ sleep retry_backoff_time(i)
134
135
  end
135
136
 
136
137
  if !response.success? && (response.status != 404 || !ignore_404)
@@ -162,6 +163,12 @@ module Kennel
162
163
  sleep reset.to_f
163
164
  end
164
165
 
166
+ # 0:0.1s - 4:2s
167
+ def retry_backoff_time(attempt)
168
+ base = 2**attempt
169
+ 0.1 * base * (0.5 + (rand / 2.0))
170
+ end
171
+
165
172
  # allow caching all requests to speedup/benchmark logic that includes repeated requests
166
173
  def with_cache(enabled, key)
167
174
  return yield unless enabled
@@ -54,6 +54,9 @@ module Kennel
54
54
  actual[:locations] = actual[:locations]&.sort
55
55
 
56
56
  ignore_default(expected, actual, DEFAULTS)
57
+
58
+ # only update downtime_ids if we are trying to manage them
59
+ actual[:options]&.delete :downtime_ids unless expected.dig(:options, :downtime_ids)
57
60
  end
58
61
  end
59
62
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "2.16.1"
3
+ VERSION = "2.17.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.1
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser