faraday-highly_available_retries 0.1.0.pre.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +16 -3
- data/lib/faraday/highly_available_retries/middleware.rb +1 -1
- data/lib/faraday/highly_available_retries/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c7beae6c72a2b4ce0b66aa27a7532b4bb3065c56e77c5f3d310c2b334fdde0
|
4
|
+
data.tar.gz: 362bcc689ffce4a331bdaa73afecaa3a58b7ebd2dbe6f0dfb420c822e35d6759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aec8d1ad550fe272628d75c828f1f47df09b010ad24ed57ed9feca125aae14f089d2e0ccf9723911d396c1d85db1ae5198a6c7e9d73156e2df8025b71db201f
|
7
|
+
data.tar.gz: 501360d550dca579dc6e961ab7bc208a2ba7c436386d5dcb1e423e965e92ca62980ce388d2473802fa843f970c2001409b32cedc6b8b50a762bf632ba3e798ad
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
**Note:** this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [0.1.
|
7
|
+
## [0.1.1] - 2023-08-16
|
8
|
+
### Fixed
|
9
|
+
- Fixed a bug where the `hosts` list was not be re-resolved on each new request made
|
10
|
+
|
11
|
+
## [0.1.0] - 2023-08-13
|
8
12
|
|
9
13
|
* Initial release.
|
data/README.md
CHANGED
@@ -11,9 +11,22 @@ This list of IP addresses is then shuffled, and if a request fails to connect to
|
|
11
11
|
And so on and so forth, until the retries are exhausted. If all of the IPs fail, then we cycle back to the first one and try again.
|
12
12
|
|
13
13
|
The reason this is impactful and should be used in conjunction with the retry middleware is that the retry middleware will
|
14
|
-
leave DNS resolution to the OS, which has the potential of
|
15
|
-
|
16
|
-
|
14
|
+
leave DNS resolution to the OS, which has the potential of two pitfalls:
|
15
|
+
|
16
|
+
1. Caching results and not try resolving to a different IP address.
|
17
|
+
2. Leaving resolution to a roll of the dice allowing the same IP to be tried multiple times.
|
18
|
+
|
19
|
+
The issue with the first pitfall is rather obvious, but the second is a bit more subtle. If you have a DNS entry that resolves
|
20
|
+
to 2 IP addresses `[A, B]` and 1 attempt, the OS resolution will result in one of the following list of attempts:
|
21
|
+
|
22
|
+
1. `[A, A]`
|
23
|
+
2. `[A, B]`
|
24
|
+
3. `[B. B]`
|
25
|
+
4. `[B, A]`
|
26
|
+
|
27
|
+
This gives you a 50% chance of hitting the same IP twice, and a 50% chance of hitting the other IP twice, meaning the retry
|
28
|
+
has no effect. By using this gem, you can ensure that the list of IPs is resolved ahead of time and cycled through to ensure
|
29
|
+
a different IP is tried on each attempt.
|
17
30
|
|
18
31
|
## Installation
|
19
32
|
|
@@ -73,7 +73,7 @@ module Faraday
|
|
73
73
|
host_list = if env[FAILOVER_ORIGINAL_HOST_ENV_KEY]
|
74
74
|
[[env[FAILOVER_ORIGINAL_HOST_ENV_KEY], env[FAILOVER_ORIGINAL_PORT_ENV_KEY]]] + @options.hosts(refresh: true)
|
75
75
|
else
|
76
|
-
@options.hosts
|
76
|
+
@options.hosts(refresh: true)
|
77
77
|
end
|
78
78
|
|
79
79
|
host_list.map { |host, port| Endpoint.from_host_and_port(host, port) }.flatten
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-highly_available_retries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-08-
|
12
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -49,8 +49,8 @@ licenses:
|
|
49
49
|
metadata:
|
50
50
|
allowed_push_host: https://rubygems.org
|
51
51
|
bug_tracker_uri: https://github.com/invoca/faraday-highly_available_retries/issues
|
52
|
-
changelog_uri: https://github.com/invoca/faraday-highly_available_retries/blob/v0.1.
|
53
|
-
documentation_uri: http://www.rubydoc.info/gems/faraday-highly_available_retries/0.1.
|
52
|
+
changelog_uri: https://github.com/invoca/faraday-highly_available_retries/blob/v0.1.1/CHANGELOG.md
|
53
|
+
documentation_uri: http://www.rubydoc.info/gems/faraday-highly_available_retries/0.1.1
|
54
54
|
homepage_uri: https://github.com/invoca/faraday-highly_available_retries
|
55
55
|
source_code_uri: https://github.com/invoca/faraday-highly_available_retries
|
56
56
|
wiki_uri: https://github.com/invoca/faraday-highly_available_retries/wiki
|
@@ -68,9 +68,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '4'
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
73
|
+
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubygems_version: 3.4.17
|
76
76
|
signing_key:
|