redis-client 0.6.2 → 0.7.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +11 -11
- data/README.md +13 -0
- data/lib/redis_client/config.rb +2 -1
- data/lib/redis_client/sentinel_config.rb +8 -1
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e19420827bc96f40097f45a68660c9158a72de1bf181a4a1713d12630964f0
|
4
|
+
data.tar.gz: ea48a355e633b2b54415e06b1fdff363879296ffb67085b97ee67ee52ec0e4dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a01f575d01adb1260d01be754ccbd3e39d03415ed4ce4f28998bfe081b298eff041a39acefbc594a058647968e6d9e5ae245f58dc05889243428abd731fc01e8
|
7
|
+
data.tar.gz: '099a087f0f32deb096302080128b817f0472be41bdce36e4df05d0d3404b2329661aa353491a388a671765349bf170c76c1284d84ffa24981ef3e46647225770'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.7.2
|
4
|
+
|
5
|
+
- Raise a distinct `RedisClient::OutOfMemoryError`, for Redis `OOM` errors.
|
6
|
+
- Fix the instrumentation API to be called even for authentication commands.
|
7
|
+
- Fix `url:` configuration to accept a trailing slash.
|
8
|
+
|
9
|
+
# 0.7.1
|
10
|
+
|
11
|
+
- Fix `#pubsub` being called when reconnection is disabled (redis-rb compatibility fix).
|
12
|
+
|
13
|
+
# 0.7.0
|
14
|
+
|
15
|
+
- Sentinel config now accept a list of URLs: `RedisClient.sentinel(sentinels: %w(redis://example.com:7000 redis://example.com:7001 ..))`
|
16
|
+
|
3
17
|
# 0.6.2
|
4
18
|
|
5
19
|
- Fix sentinel to not connected to s_down or o_down replicas.
|
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.7.2)
|
5
5
|
connection_pool
|
6
6
|
|
7
7
|
GEM
|
@@ -14,33 +14,33 @@ GEM
|
|
14
14
|
hiredis (0.6.3)
|
15
15
|
hiredis (0.6.3-java)
|
16
16
|
minitest (5.15.0)
|
17
|
-
parallel (1.
|
18
|
-
parser (3.1.1
|
17
|
+
parallel (1.22.1)
|
18
|
+
parser (3.1.2.1)
|
19
19
|
ast (~> 2.4.1)
|
20
20
|
rainbow (3.1.1)
|
21
21
|
rake (13.0.6)
|
22
|
-
rake-compiler (1.
|
22
|
+
rake-compiler (1.2.0)
|
23
23
|
rake
|
24
24
|
redis (4.6.0)
|
25
|
-
regexp_parser (2.
|
25
|
+
regexp_parser (2.5.0)
|
26
26
|
rexml (3.2.5)
|
27
|
-
rubocop (1.
|
27
|
+
rubocop (1.28.2)
|
28
28
|
parallel (~> 1.10)
|
29
29
|
parser (>= 3.1.0.0)
|
30
30
|
rainbow (>= 2.2.2, < 4.0)
|
31
31
|
regexp_parser (>= 1.8, < 3.0)
|
32
32
|
rexml
|
33
|
-
rubocop-ast (>= 1.
|
33
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
34
34
|
ruby-progressbar (~> 1.7)
|
35
35
|
unicode-display_width (>= 1.4.0, < 3.0)
|
36
|
-
rubocop-ast (1.
|
36
|
+
rubocop-ast (1.17.0)
|
37
37
|
parser (>= 3.1.1.0)
|
38
|
-
rubocop-minitest (0.
|
38
|
+
rubocop-minitest (0.19.1)
|
39
39
|
rubocop (>= 0.90, < 2.0)
|
40
40
|
ruby-progressbar (1.11.0)
|
41
41
|
stackprof (0.2.19)
|
42
|
-
toxiproxy (2.0.
|
43
|
-
unicode-display_width (2.
|
42
|
+
toxiproxy (2.0.2)
|
43
|
+
unicode-display_width (2.2.0)
|
44
44
|
|
45
45
|
PLATFORMS
|
46
46
|
ruby
|
data/README.md
CHANGED
@@ -100,6 +100,19 @@ redis_config = RedisClient.sentinel(
|
|
100
100
|
)
|
101
101
|
```
|
102
102
|
|
103
|
+
or:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
redis_config = RedisClient.sentinel(
|
107
|
+
name: "mymaster",
|
108
|
+
sentinels: [
|
109
|
+
"redis://127.0.0.1:26380",
|
110
|
+
"redis://127.0.0.1:26381",
|
111
|
+
],
|
112
|
+
role: :master,
|
113
|
+
)
|
114
|
+
```
|
115
|
+
|
103
116
|
* The name identifies a group of Redis instances composed of a master and one or more replicas (`mymaster` in the example).
|
104
117
|
|
105
118
|
* It is possible to optionally provide a role. The allowed roles are `:master`
|
data/lib/redis_client/config.rb
CHANGED
@@ -149,7 +149,8 @@ class RedisClient
|
|
149
149
|
URI.decode_www_form_component(uri.password)
|
150
150
|
end
|
151
151
|
|
152
|
-
|
152
|
+
path = uri.path&.delete_prefix("/")
|
153
|
+
kwargs[:db] ||= Integer(path) if path && !path.empty?
|
153
154
|
end
|
154
155
|
|
155
156
|
super(**kwargs)
|
@@ -26,7 +26,14 @@ class RedisClient
|
|
26
26
|
end
|
27
27
|
|
28
28
|
@name = name
|
29
|
-
@sentinel_configs = sentinels.map
|
29
|
+
@sentinel_configs = sentinels.map do |s|
|
30
|
+
case s
|
31
|
+
when String
|
32
|
+
Config.new(**extra_config, url: s)
|
33
|
+
else
|
34
|
+
Config.new(**extra_config, **s)
|
35
|
+
end
|
36
|
+
end
|
30
37
|
@sentinels = {}.compare_by_identity
|
31
38
|
@role = role
|
32
39
|
@mutex = Mutex.new
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
@@ -109,12 +109,14 @@ class RedisClient
|
|
109
109
|
PermissionError = Class.new(CommandError)
|
110
110
|
ReadOnlyError = Class.new(CommandError)
|
111
111
|
WrongTypeError = Class.new(CommandError)
|
112
|
+
OutOfMemoryError = Class.new(CommandError)
|
112
113
|
|
113
114
|
CommandError::ERRORS = {
|
114
115
|
"WRONGPASS" => AuthenticationError,
|
115
116
|
"NOPERM" => PermissionError,
|
116
117
|
"READONLY" => ReadOnlyError,
|
117
118
|
"WRONGTYPE" => WrongTypeError,
|
119
|
+
"OOM" => OutOfMemoryError,
|
118
120
|
}.freeze
|
119
121
|
|
120
122
|
class << self
|
@@ -589,7 +591,11 @@ class RedisClient
|
|
589
591
|
|
590
592
|
def ensure_connected(retryable: true)
|
591
593
|
if @disable_reconnection
|
592
|
-
|
594
|
+
if block_given?
|
595
|
+
yield @raw_connection
|
596
|
+
else
|
597
|
+
@raw_connection
|
598
|
+
end
|
593
599
|
elsif retryable
|
594
600
|
tries = 0
|
595
601
|
connection = nil
|
@@ -648,11 +654,15 @@ class RedisClient
|
|
648
654
|
# The connection prelude is deliberately not sent to Middlewares
|
649
655
|
if config.sentinel?
|
650
656
|
prelude << ["ROLE"]
|
651
|
-
role, =
|
657
|
+
role, = Middlewares.call_pipelined(prelude, config) do
|
658
|
+
connection.call_pipelined(prelude, nil).last
|
659
|
+
end
|
652
660
|
config.check_role!(role)
|
653
661
|
else
|
654
662
|
unless prelude.empty?
|
655
|
-
|
663
|
+
Middlewares.call_pipelined(prelude, config) do
|
664
|
+
connection.call_pipelined(prelude, nil)
|
665
|
+
end
|
656
666
|
end
|
657
667
|
end
|
658
668
|
|
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.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|