network_resiliency 0.6.8 → 0.6.9

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: b907866b5327e9488dca8b828bbf3b14c84a257c6a62c6381197455f11fc337b
4
- data.tar.gz: 8aa6d3fbe7a1a0bae41711b18f02659363b620af749bc9cc778fd244398c9e36
3
+ metadata.gz: 8380eb51ca287984c7460bcaec21486e9f3b0d659a4938d9d8acba847408455e
4
+ data.tar.gz: 6af73756043d429bbda699f6424385c51487433f759db9a7f5e4e669edfbbd53
5
5
  SHA512:
6
- metadata.gz: 98c21b67a95c4ac785df751ae874e53f5116908462e5d17944831202e414ddc3644601d7e9c3ca6b00703a900490e56d575cff7a896a2606ef3167521ebfde88
7
- data.tar.gz: 7f9d19f1546bfb251243cd142899af1eb74d561e9004e25b91b28e072d7f23f68646c0c2ba5b145ab933c28eafc762303e56811169ce4dd8f2822f60a235bef5
6
+ metadata.gz: 0e926bdcfba052de25ae2556478262ffebc6f484eb7dfd7cc6c2ba718128ba6b2bc8a0327f24a9b1e1a2a6cbf5130ed614465dcb3d79092918d7ae47741a9581
7
+ data.tar.gz: 7a08743fe845c881e80124f8869d82563419ced41adb68ab654e3aad96d88ca5d6b70ae5dace10135a078652207605a7f4df8c39648f9b0a05e700602da78a5b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### v0.6.9 (2023-12-07)
2
+ - tag mode
3
+ - request timeout header
4
+
1
5
  ### v0.6.8 (2023-12-04)
2
6
  - slim metrics
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_resiliency (0.6.8)
4
+ network_resiliency (0.6.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -13,9 +13,6 @@ require "network_resiliency"
13
13
 
14
14
  NetworkResiliency.configure do |conf|
15
15
  conf.statsd = Datadog::Statsd.new
16
-
17
- # patch Redis instances
18
- conf.patch :redis
19
16
  end
20
17
 
21
18
  Redis.new.ping
@@ -5,6 +5,8 @@ module NetworkResiliency
5
5
  module HTTP
6
6
  extend self
7
7
 
8
+ REQUEST_TIMEOUT_HEADER = "X-Request-Timeout"
9
+
8
10
  def patch(instance = nil)
9
11
  return if patched?(instance)
10
12
 
@@ -61,9 +63,10 @@ module NetworkResiliency
61
63
  attempts += 1
62
64
  error = nil
63
65
 
64
- set_timeout.call(timeouts.shift)
66
+ timeout = timeouts.shift
67
+ set_timeout.call(timeout)
65
68
 
66
- yield
69
+ yield timeout
67
70
  rescue ::Timeout::Error,
68
71
  defined?(OpenSSL::SSL) ? OpenSSL::OpenSSLError : IOError,
69
72
  SystemCallError => e
@@ -115,7 +118,12 @@ module NetworkResiliency
115
118
 
116
119
  idepotent = Net::HTTP::IDEMPOTENT_METHODS_.include?(req.method)
117
120
 
118
- with_resilience(:request, destination, idepotent) { super }
121
+ with_resilience(:request, destination, idepotent) do |timeout|
122
+ # send timeout via headers
123
+ req[REQUEST_TIMEOUT_HEADER] = timeout
124
+
125
+ super
126
+ end
119
127
  end
120
128
  end
121
129
  end
@@ -1,3 +1,3 @@
1
1
  module NetworkResiliency
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
  end
@@ -177,6 +177,7 @@ module NetworkResiliency
177
177
  adapter: adapter,
178
178
  destination: destination,
179
179
  error: error,
180
+ mode: mode(action.to_sym),
180
181
  attempts: (attempts if attempts > 1),
181
182
  }.compact,
182
183
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_resiliency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug