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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +0 -3
- data/lib/network_resiliency/adapter/http.rb +11 -3
- data/lib/network_resiliency/version.rb +1 -1
- data/lib/network_resiliency.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8380eb51ca287984c7460bcaec21486e9f3b0d659a4938d9d8acba847408455e
|
4
|
+
data.tar.gz: 6af73756043d429bbda699f6424385c51487433f759db9a7f5e4e669edfbbd53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e926bdcfba052de25ae2556478262ffebc6f484eb7dfd7cc6c2ba718128ba6b2bc8a0327f24a9b1e1a2a6cbf5130ed614465dcb3d79092918d7ae47741a9581
|
7
|
+
data.tar.gz: 7a08743fe845c881e80124f8869d82563419ced41adb68ab654e3aad96d88ca5d6b70ae5dace10135a078652207605a7f4df8c39648f9b0a05e700602da78a5b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -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
|
-
|
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)
|
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
|
data/lib/network_resiliency.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|