redis-client 0.17.1 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -4
- 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: 920d97dcf258796ba88bb2f087fa89c1595dd245f67292c7432893848baacd0b
|
4
|
+
data.tar.gz: 07151d3aa036f7c513e7baa2cc94c22a7f9b4af8a09e132b1943716cd458c408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6f664cf2c5fe77115606dc15e031e6bccc55c440b55d521ef5429653acb89bf55597dd4e5cd4892fb61f9452790a2ca41e32e72c6f824c7da9609987b14ff42
|
7
|
+
data.tar.gz: c6a34fe93aac6d5ae5c8995881e17581e64a762d0fdc3d3fe1772b07b1759196b2ca5a27e14e00c826399d03a1259f799c816ac1ca1ee001314d9b32f341ecb8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.19.1
|
4
|
+
|
5
|
+
- Fixed a bug in `hiredis-client` that could cause a crash if interrupted by `Timeout.timeout` or other `Thread#raise` based mecanism.
|
6
|
+
- Fixed a GC bug that could cause crashes in `hiredis-client`.
|
7
|
+
|
8
|
+
# 0.19.0
|
9
|
+
|
10
|
+
- Revalidate connection in `RedisClient#connected?`
|
11
|
+
- Eagerly fail if `db:` isn't an Integer. #151.
|
12
|
+
|
13
|
+
# 0.18.0
|
14
|
+
|
15
|
+
- Expose more connection details such as `host`, `db`, etc on `RedisClient`.
|
16
|
+
|
3
17
|
# 0.17.1
|
4
18
|
|
5
19
|
- Add support for `NaN` in RESP3 protocol doubles.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-client (0.
|
4
|
+
redis-client (0.19.1)
|
5
5
|
connection_pool
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
-
benchmark-ips (2.
|
11
|
+
benchmark-ips (2.13.0)
|
12
12
|
byebug (11.1.3)
|
13
13
|
connection_pool (2.4.1)
|
14
14
|
hiredis (0.6.3)
|
@@ -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.1
|
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-21 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+
|