redis-cluster-client 0.11.2 → 0.11.3

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: 9ce265da4f3a871e187b651c27ce9ee1d9a9321e346c2b1c3d1eba6f40139192
4
- data.tar.gz: 95252d4d8b20e77a3bcc91035208c3d9baafbf2ad31d60adaa4376b38c75c2fa
3
+ metadata.gz: a18bda4b076ac6a39e7558b39b0ff5f443e2f9d192ff45ee6749e64b3a349fbd
4
+ data.tar.gz: ed166898e6dbb23b316d87162767fe06eb34440029bdb6f33764c58038c20d88
5
5
  SHA512:
6
- metadata.gz: b2b7b9f733569fe7ba66dc4d49241ac827e6c3e23ea74fa9a04efbb985b601ca575302b8316e891160896d880cc74a2bdb3b88533478cbdab8e1e90b6d2d8926
7
- data.tar.gz: a7982da3ad7a8a373f1ce9993262a279e50889be71bdc5913806da006a9252b65d3574bf816bc2ddb98f0034b6195890c23486eb2155d2ca8a6785753c3f69f1
6
+ metadata.gz: 7b1ca4265e58d3d4cdb00c0ad9629d72dec6c1a0681d34663e38adb147a0d66985be3f4257d6f6d0c62752cda0f710bfd9e7eb9f3694e07ec4796ce99677c148
7
+ data.tar.gz: 178592be6e79bfdf2c5288f558fca21116aabd98cc10b4436298393d22f895844523b3e32f28635172229a404c55d83e52e242230677ab00d509dba7d70adc0c
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'redis_client'
4
+ require 'redis_client/cluster/errors'
4
5
  require 'redis_client/cluster/normalized_cmd_name'
5
6
 
6
7
  class RedisClient
@@ -91,10 +92,8 @@ class RedisClient
91
92
  when ::RedisClient::CommandError
92
93
  raise event unless event.message.start_with?('MOVED', 'CLUSTERDOWN Hash slot not served')
93
94
 
94
- @router.renew_cluster_state
95
95
  break start_over
96
96
  when ::RedisClient::ConnectionError
97
- @router.renew_cluster_state
98
97
  break start_over
99
98
  when StandardError then raise event
100
99
  when Array then break event
@@ -151,25 +150,23 @@ class RedisClient
151
150
  def handle_connection_error(node_key, ignore: false)
152
151
  yield
153
152
  rescue ::RedisClient::ConnectionError
154
- @state_dict[node_key].close
153
+ @state_dict[node_key]&.close
155
154
  @state_dict.delete(node_key)
156
155
  @router.renew_cluster_state
157
156
  raise unless ignore
158
157
  end
159
158
 
160
159
  def start_over
161
- @state_dict.each_value(&:close)
162
- @state_dict.clear
163
- @commands.each do |command|
164
- loop do
165
- _call(command)
166
- break
167
- rescue ::RedisClient::ConnectionError
168
- sleep 1.0
169
- end
160
+ loop do
161
+ @router.renew_cluster_state
162
+ @state_dict.each_value(&:close)
163
+ @state_dict.clear
164
+ @queue.clear
165
+ @commands.each { |command| _call(command) }
166
+ break
167
+ rescue ::RedisClient::ConnectionError, ::RedisClient::Cluster::NodeMightBeDown
168
+ sleep 1.0
170
169
  end
171
-
172
- nil
173
170
  end
174
171
  end
175
172
  end
@@ -29,7 +29,7 @@ class RedisClient
29
29
  @pool = pool
30
30
  @client_kwargs = kwargs
31
31
  @node = ::RedisClient::Cluster::Node.new(concurrent_worker, config: config, pool: pool, **kwargs)
32
- renew_cluster_state
32
+ @node.reload!
33
33
  @command = ::RedisClient::Cluster::Command.load(@node.replica_clients.shuffle, slow_command_timeout: config.slow_command_timeout)
34
34
  @command_builder = @config.command_builder
35
35
  end
@@ -241,6 +241,8 @@ class RedisClient
241
241
 
242
242
  def renew_cluster_state
243
243
  @node.reload!
244
+ rescue ::RedisClient::Cluster::InitialSetupError
245
+ # ignore
244
246
  end
245
247
 
246
248
  def close
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.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client