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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1586a787b6a0c7573a295515804a0342496cc1f8f9effe1d2e90d34004427dea
4
- data.tar.gz: e1358cf8426ea5f6df3f8b039809d5062b18413f6950ecdea20d0379ae68bf5c
3
+ metadata.gz: 651969085a16547763a2df77d40285f300c602fea51089989ec4b6fe62832c3d
4
+ data.tar.gz: aed0094cc23da42f1870ace6b94badc64493f2bf85053ab387bd22919c5e939a
5
5
  SHA512:
6
- metadata.gz: d54c7fddc889d91a5f69505b04af146630a13038d3d4d1af05f3e19d083c9ff05fed3ff7e42c0ebe7f576c8e91d6880bdff8466b88990fb27488579a63de7df9
7
- data.tar.gz: 88a4cc4c0c7848a0d1eef1ac1bb50d380df2c7bcc4a209fe7ea7733080c63fc929f4d5480e48c945713c2b5083efa967825b909da1ecf52bf414c5b9160d822d
6
+ metadata.gz: b9310d55228dee7660d2e616349b014652c5eb5559b5db0f85a915500dfdde693843d6f9c1abb3195749bb7d7b4cfe1ca3341deedb1e8b68b86c7d14c567485f
7
+ data.tar.gz: 81bb776dac713ab01d1833346658be050488b3c24687bd4c603b3e47b3c444e83bb709074576e4a796da637a449914e6916420b505176a022fd51b92b6a42115
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_failover (0.6.3)
4
+ rails_failover (0.6.4)
5
5
  activerecord (~> 6.0)
6
6
  concurrent-ruby
7
7
  railties (~> 6.0)
@@ -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
- is_failover_replica = (options[:host] == options[:replica_host]) &&
14
- (options[:port] == options[:replica_port])
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 = is_failover_replica ? REPLICA : PRIMARY
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 !is_failover_replica
31
+ Handler.instance.verify_primary(options) if is_primary
30
32
  raise e
31
33
  end
32
34
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsFailover
4
- VERSION = "0.6.3"
4
+ VERSION = "0.6.4"
5
5
  end
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.3
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-07 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord