redis-client 0.24.0 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c3cb528ecb15130b80ce97d00a5e0e45c31edfc6147068516e1a52295a94045
4
- data.tar.gz: b4517fbd99d0f3997e510b6d0d56c345c1fceb1ad44fcac59cceb28faf4326b5
3
+ metadata.gz: e14494ff0e910564d0afcc8dea365b35e428c73364d4da0c31c84f8a9ada8d8b
4
+ data.tar.gz: dacf316c8c4893b1d0fd95e010a010837485825390fbd83b1620f8cc6dff6985
5
5
  SHA512:
6
- metadata.gz: dbc7fcacc084fcd9d765337ad48a2a8ee413eecfec48f1a166fbd58510299cf92b3e058ce08620055deadeca86464c2c25fe6cddcccab532ab3d2cd741f9cef0
7
- data.tar.gz: '09164c4ea9f7021d58df97690f78e7940821a44eb7e12cc4c25324bd17e0e784f447443accedbe2299e6d8c0a0a6f15391491465c4c32baaa56286501b77b693'
6
+ metadata.gz: 00ef6af52d83d2b35a5a8e638cb001f98b16d5f9752c35c107e66665415ac108d728992bf879b5577ac72859af67c70c3b0c4b40c62da73aee5cca17122de23f
7
+ data.tar.gz: d9564edbac42517600787da3bcf3c929158e5a4d4e757f6b9ccff7cd6ee296637d89521adfbc902fc83ac880d53a155c289e3bbc09254bf32f8530cf3ab308dd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Unreleased
2
2
 
3
+ # 0.25.2
4
+
5
+ - Fix circuit breakers to respect the `error_threshold_timeout` config is provided.
6
+ - Fix circuit breakers to clear errors when closing back.
7
+
8
+ # 0.25.1
9
+
10
+ - Fix Ruby driver TCP keep alive TTL. It was intended to be 120 seconds but was mistakenly set to 15 seconds.
11
+
12
+ # 0.25.0
13
+
14
+ - Fix `hiredis-client` compilation with GCC 15.
15
+ - Fix `hiredis-client` from a work directory with spaces.
16
+ - Add `CommandError#code`.
17
+ - Add `RedisClient::NoScriptError` for `EVALSHA`.
18
+
3
19
  # 0.24.0
4
20
 
5
21
  - Allow `sentinel_password` to be provided as a `Proc`.
@@ -79,7 +79,7 @@ class RedisClient
79
79
 
80
80
  def record_error
81
81
  now = RedisClient.now
82
- expiry = now - @error_timeout
82
+ expiry = now - @error_threshold_timeout
83
83
  @lock.synchronize do
84
84
  if @state == :closed
85
85
  @errors.reject! { |t| t < expiry }
@@ -100,6 +100,7 @@ class RedisClient
100
100
 
101
101
  @successes += 1
102
102
  if @successes >= @success_threshold
103
+ @errors.clear
103
104
  @state = :closed
104
105
  end
105
106
  end
@@ -169,7 +169,7 @@ class RedisClient
169
169
  if %i[SOL_TCP SOL_SOCKET TCP_KEEPIDLE TCP_KEEPINTVL TCP_KEEPCNT].all? { |c| Socket.const_defined? c } # Linux
170
170
  def enable_socket_keep_alive(socket)
171
171
  socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
172
- socket.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPIDLE, KEEP_ALIVE_INTERVAL)
172
+ socket.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPIDLE, KEEP_ALIVE_TTL)
173
173
  socket.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPINTVL, KEEP_ALIVE_INTERVAL)
174
174
  socket.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPCNT, KEEP_ALIVE_PROBES)
175
175
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RedisClient
4
- VERSION = "0.24.0"
4
+ VERSION = "0.25.2"
5
5
  end
data/lib/redis_client.rb CHANGED
@@ -130,8 +130,18 @@ class RedisClient
130
130
  end
131
131
  end
132
132
 
133
+ module HasCode
134
+ attr_reader :code
135
+
136
+ def initialize(message = nil, code = nil)
137
+ super(message)
138
+ @code = code
139
+ end
140
+ end
141
+
133
142
  class CommandError < Error
134
143
  include HasCommand
144
+ include HasCode
135
145
 
136
146
  class << self
137
147
  def parse(error_message)
@@ -144,7 +154,7 @@ class RedisClient
144
154
  end
145
155
  code ||= error_message.split(' ', 2).first
146
156
  klass = ERRORS.fetch(code, self)
147
- klass.new(error_message.strip)
157
+ klass.new(error_message.strip, code.freeze)
148
158
  end
149
159
  end
150
160
  end
@@ -153,12 +163,15 @@ class RedisClient
153
163
  PermissionError = Class.new(CommandError)
154
164
  WrongTypeError = Class.new(CommandError)
155
165
  OutOfMemoryError = Class.new(CommandError)
166
+ NoScriptError = Class.new(CommandError)
156
167
 
157
168
  ReadOnlyError = Class.new(ConnectionError)
158
169
  ReadOnlyError.include(HasCommand)
170
+ ReadOnlyError.include(HasCode)
159
171
 
160
172
  MasterDownError = Class.new(ConnectionError)
161
173
  MasterDownError.include(HasCommand)
174
+ MasterDownError.include(HasCode)
162
175
 
163
176
  CommandError::ERRORS = {
164
177
  "WRONGPASS" => AuthenticationError,
@@ -167,6 +180,7 @@ class RedisClient
167
180
  "MASTERDOWN" => MasterDownError,
168
181
  "WRONGTYPE" => WrongTypeError,
169
182
  "OOM" => OutOfMemoryError,
183
+ "NOSCRIPT" => NoScriptError,
170
184
  }.freeze
171
185
 
172
186
  class << self
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.25.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-05 00:00:00.000000000 Z
10
+ date: 2025-08-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: connection_pool