redis-client 0.17.1 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/lib/redis_client/config.rb +6 -1
- data/lib/redis_client/ruby_connection.rb +1 -0
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +41 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dfa2a6fb000223a3150caeffa1f5341e322b436128dc0cdb0b22998586e1a56
|
4
|
+
data.tar.gz: cc8cd32d6036a00710b5d0dc728382c7be48e58fcbc07759d392267cf9a6397b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69f9ba83f34836944c0af218f1dd117c76d6f4a09a5aeee001727b19ac01013e1bb3ba308386690a34960282153d4075cd7949fc7b0a25c89840b82eceb5dbdf
|
7
|
+
data.tar.gz: 54d85162e372c33756adf4af7da1f0abe3d0cd4789336d678a1fc4a37afac749c929d7032a58d3e92f3576ed1001c3ec60bd15670762dc2553a69744891a3b06
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.19.0
|
4
|
+
|
5
|
+
- Revalidate connection in `RedisClient#connected?`
|
6
|
+
- Eagerly fail if `db:` isn't an Integer. #151.
|
7
|
+
|
8
|
+
# 0.18.0
|
9
|
+
|
10
|
+
- Expose more connection details such as `host`, `db`, etc on `RedisClient`.
|
11
|
+
|
3
12
|
# 0.17.1
|
4
13
|
|
5
14
|
- Add support for `NaN` in RESP3 protocol doubles.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-client (0.
|
4
|
+
redis-client (0.19.0)
|
5
5
|
connection_pool
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
parser (3.1.2.1)
|
19
19
|
ast (~> 2.4.1)
|
20
20
|
rainbow (3.1.1)
|
21
|
-
rake (13.0
|
21
|
+
rake (13.1.0)
|
22
22
|
rake-compiler (1.2.5)
|
23
23
|
rake
|
24
24
|
redis (4.6.0)
|
@@ -53,7 +53,7 @@ DEPENDENCIES
|
|
53
53
|
byebug
|
54
54
|
hiredis
|
55
55
|
minitest
|
56
|
-
rake (~> 13.
|
56
|
+
rake (~> 13.1)
|
57
57
|
rake-compiler
|
58
58
|
redis (~> 4.6)
|
59
59
|
redis-client!
|
data/lib/redis_client/config.rb
CHANGED
@@ -41,7 +41,12 @@ class RedisClient
|
|
41
41
|
)
|
42
42
|
@username = username
|
43
43
|
@password = password
|
44
|
-
@db =
|
44
|
+
@db = begin
|
45
|
+
Integer(db || DEFAULT_DB)
|
46
|
+
rescue ArgumentError
|
47
|
+
raise ArgumentError, "db: must be an Integer, got: #{db.inspect}"
|
48
|
+
end
|
49
|
+
|
45
50
|
@id = id
|
46
51
|
@ssl = ssl || false
|
47
52
|
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
@@ -179,6 +179,38 @@ class RedisClient
|
|
179
179
|
config.server_url
|
180
180
|
end
|
181
181
|
|
182
|
+
def id
|
183
|
+
config.id
|
184
|
+
end
|
185
|
+
|
186
|
+
def timeout
|
187
|
+
config.read_timeout
|
188
|
+
end
|
189
|
+
|
190
|
+
def db
|
191
|
+
config.db
|
192
|
+
end
|
193
|
+
|
194
|
+
def host
|
195
|
+
config.host unless config.path
|
196
|
+
end
|
197
|
+
|
198
|
+
def port
|
199
|
+
config.port unless config.path
|
200
|
+
end
|
201
|
+
|
202
|
+
def path
|
203
|
+
config.path
|
204
|
+
end
|
205
|
+
|
206
|
+
def username
|
207
|
+
config.username
|
208
|
+
end
|
209
|
+
|
210
|
+
def password
|
211
|
+
config.password
|
212
|
+
end
|
213
|
+
|
182
214
|
def size
|
183
215
|
1
|
184
216
|
end
|
@@ -190,17 +222,18 @@ class RedisClient
|
|
190
222
|
|
191
223
|
def timeout=(timeout)
|
192
224
|
super
|
193
|
-
raw_connection
|
225
|
+
@raw_connection&.read_timeout = timeout
|
226
|
+
@raw_connection&.write_timeout = timeout
|
194
227
|
end
|
195
228
|
|
196
229
|
def read_timeout=(timeout)
|
197
230
|
super
|
198
|
-
raw_connection
|
231
|
+
@raw_connection&.read_timeout = timeout
|
199
232
|
end
|
200
233
|
|
201
234
|
def write_timeout=(timeout)
|
202
235
|
super
|
203
|
-
raw_connection
|
236
|
+
@raw_connection&.write_timeout = timeout
|
204
237
|
end
|
205
238
|
|
206
239
|
def pubsub
|
@@ -354,7 +387,7 @@ class RedisClient
|
|
354
387
|
end
|
355
388
|
|
356
389
|
def connected?
|
357
|
-
@raw_connection&.
|
390
|
+
@raw_connection&.revalidate
|
358
391
|
end
|
359
392
|
|
360
393
|
def close
|
@@ -637,6 +670,7 @@ class RedisClient
|
|
637
670
|
elsif retryable
|
638
671
|
tries = 0
|
639
672
|
connection = nil
|
673
|
+
preferred_error = nil
|
640
674
|
begin
|
641
675
|
connection = raw_connection
|
642
676
|
if block_given?
|
@@ -645,13 +679,15 @@ class RedisClient
|
|
645
679
|
connection
|
646
680
|
end
|
647
681
|
rescue ConnectionError, ProtocolError => error
|
682
|
+
preferred_error ||= error
|
683
|
+
preferred_error = error unless error.is_a?(CircuitBreaker::OpenCircuitError)
|
648
684
|
close
|
649
685
|
|
650
686
|
if !@disable_reconnection && config.retry_connecting?(tries, error)
|
651
687
|
tries += 1
|
652
688
|
retry
|
653
689
|
else
|
654
|
-
raise
|
690
|
+
raise preferred_error
|
655
691
|
end
|
656
692
|
end
|
657
693
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
80
|
+
rubygems_version: 3.4.10
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Simple low-level client for Redis 6+
|