redis-cluster-client 0.3.1 → 0.3.2

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: 619becbe41f6cb5c829de9df021a399ac966b1976284e06e7792c0b570061e32
4
- data.tar.gz: 5b6ddc1c8410bcf8ab03538bf5dd77d0425d4bf34f170ea026ff4d1c1be2ce8e
3
+ metadata.gz: 7fa6c9386e1ffd7571fdc8a29bea08960387d958149b972e1cf27d28eac98da0
4
+ data.tar.gz: e532422c94e7416df967f772112c77861f4501d5dcd73c2d9893237586077677
5
5
  SHA512:
6
- metadata.gz: 658a78bdd61f7e902b2385c73f23f3fa692a73b77a073afc0cb3d0616726a99cb65884ec4ab7cbae2bdd4574444f1de2f639105eaa4f40e1c07c186d7589dff5
7
- data.tar.gz: 33b9d88cc33fec6f5a556ae3beb494c9875796088b93a47b647efe02db6f41540d49f3120d5d7114c8757aa78e29b173abd20a8b2a2341861e953a0ab4b0f67a
6
+ metadata.gz: ef29a0346608779f6528559e52e348df690baf44db0cd8c9e1fe94e44bf9d282eca81101a1246cb0bff418ec398b2b207eb47563e2b976b6523e0fe6583e55fb
7
+ data.tar.gz: 7e4059d96f02c078989c7bae6cc4790f1580d0fc721c545a86d694ddae7eb90541573c67bb66a93bc6732b45b1f1ac18a3370b0d3d20df41760be9eb78255f5c
@@ -21,6 +21,7 @@ class RedisClient
21
21
  @replications.each_value { |keys| keys.sort_by! { |k| latencies.fetch(k) } }
22
22
  @replica_clients = select_replica_clients(@replications, @clients)
23
23
  @clients_for_scanning = select_clients_for_scanning(@replications, @clients)
24
+ @existed_replicas = @replications.reject { |_, v| v.empty? }.values
24
25
  end
25
26
 
26
27
  def clients_for_scanning(seed: nil) # rubocop:disable Lint/UnusedMethodArgument
@@ -33,7 +34,7 @@ class RedisClient
33
34
 
34
35
  def any_replica_node_key(seed: nil)
35
36
  random = seed.nil? ? Random : Random.new(seed)
36
- @replications.reject { |_, v| v.empty? }.values.sample(random: random).first
37
+ @existed_replicas.sample(random: random).first
37
38
  end
38
39
 
39
40
  private
@@ -42,6 +42,17 @@ class RedisClient
42
42
  @mutex = Mutex.new
43
43
  end
44
44
 
45
+ def dup
46
+ self.class.new(
47
+ nodes: @node_configs,
48
+ replica: @replica,
49
+ replica_affinity: @replica_affinity,
50
+ fixed_hostname: @fixed_hostname,
51
+ client_implementation: @client_implementation,
52
+ **@client_config
53
+ )
54
+ end
55
+
45
56
  def inspect
46
57
  "#<#{self.class.name} #{per_node_key.values}>"
47
58
  end
@@ -79,10 +90,6 @@ class RedisClient
79
90
  @mutex.synchronize { @node_configs << { host: host, port: port } }
80
91
  end
81
92
 
82
- def dup
83
- self.class.new(nodes: @node_configs, replica: @replica, fixed_hostname: @fixed_hostname, **@client_config)
84
- end
85
-
86
93
  private
87
94
 
88
95
  def build_node_configs(addrs)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cluster-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client