rails_failover 0.6.3 → 0.6.4
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/lib/rails_failover/redis/connector.rb +6 -4
- data/lib/rails_failover/version.rb +1 -1
- 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: 651969085a16547763a2df77d40285f300c602fea51089989ec4b6fe62832c3d
|
4
|
+
data.tar.gz: aed0094cc23da42f1870ace6b94badc64493f2bf85053ab387bd22919c5e939a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9310d55228dee7660d2e616349b014652c5eb5559b5db0f85a915500dfdde693843d6f9c1abb3195749bb7d7b4cfe1ca3341deedb1e8b68b86c7d14c567485f
|
7
|
+
data.tar.gz: 81bb776dac713ab01d1833346658be050488b3c24687bd4c603b3e47b3c444e83bb709074576e4a796da637a449914e6916420b505176a022fd51b92b6a42115
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.6.4] - 2020-12-09
|
10
|
+
|
11
|
+
- FIX: Handle the case when the replica is set equal to the primary
|
12
|
+
|
9
13
|
## [0.6.3] - 2020-12-07
|
10
14
|
|
11
15
|
- FIX: Handle clients which are connecting during fallback
|
data/Gemfile.lock
CHANGED
@@ -7,13 +7,15 @@ module RailsFailover
|
|
7
7
|
class Connector < ::Redis::Client::Connector
|
8
8
|
def initialize(options)
|
9
9
|
orignal_driver = options[:driver]
|
10
|
+
options[:primary_host] = options[:host]
|
11
|
+
options[:primary_port] = options[:port]
|
10
12
|
|
11
13
|
options[:driver] = Class.new(options[:driver]) do
|
12
14
|
def self.connect(options)
|
13
|
-
|
14
|
-
|
15
|
+
is_primary = (options[:host] == options[:primary_host]) &&
|
16
|
+
(options[:port] == options[:primary_port])
|
15
17
|
super(options).tap do |conn|
|
16
|
-
conn.rails_failover_role =
|
18
|
+
conn.rails_failover_role = is_primary ? PRIMARY : REPLICA
|
17
19
|
end
|
18
20
|
rescue ::Redis::TimeoutError,
|
19
21
|
SocketError,
|
@@ -26,7 +28,7 @@ module RailsFailover
|
|
26
28
|
Errno::ETIMEDOUT,
|
27
29
|
Errno::EINVAL => e
|
28
30
|
|
29
|
-
Handler.instance.verify_primary(options) if
|
31
|
+
Handler.instance.verify_primary(options) if is_primary
|
30
32
|
raise e
|
31
33
|
end
|
32
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_failover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Tan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|