redis-client 0.11.1 → 0.11.2
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 -1
- data/Gemfile.lock +1 -1
- data/lib/redis_client/config.rb +4 -0
- data/lib/redis_client/connection_mixin.rb +2 -2
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +14 -8
- 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: 24ef1685664b6af416108d0994b89e1c8d70e3ba1e5d17363f9bc92a0a34137f
|
4
|
+
data.tar.gz: 065e1efd905230b129fe0e82569ae4691644c2126c507eb8e9c44fec556e6584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f1b143a96e5c5d7f96919187e8a7d7b481da1661d19044c4b699cad713761fcf371b5733ab5200d05e176f782318c6fe23a73568eeb6f610a061a97f1706181
|
7
|
+
data.tar.gz: b97603e2d45b1008b4920a9576315809f7d41de0cd95f05f2c2a1e1241e3e9bbdf3d57c80afc15cc823d795bb41686ad079f7cb27b203cd03d884291a165787a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
-
|
3
|
+
# 0.11.2
|
4
|
+
|
5
|
+
- Close connection on READONLY errors. Fix: #64
|
6
|
+
- Handle Redis 6+ servers with a missing HELLO command. See: #67
|
7
|
+
- Validate `url` parameters a bit more strictly. Fix #61
|
8
|
+
|
9
|
+
# 0.11.1
|
10
|
+
|
11
|
+
- hiredis: Workaround a compilation bug with Xcode 14.0. Fix: #58
|
4
12
|
- Accept `URI` instances as `uri` parameter.
|
5
13
|
|
6
14
|
# 0.11.0
|
data/Gemfile.lock
CHANGED
data/lib/redis_client/config.rb
CHANGED
@@ -155,6 +155,10 @@ class RedisClient
|
|
155
155
|
)
|
156
156
|
if url
|
157
157
|
uri = URI(url)
|
158
|
+
unless uri.scheme == "redis" || uri.scheme == "rediss"
|
159
|
+
raise ArgumentError, "Invalid URL: #{url.inspect}"
|
160
|
+
end
|
161
|
+
|
158
162
|
kwargs[:ssl] = uri.scheme == "rediss" unless kwargs.key?(:ssl)
|
159
163
|
|
160
164
|
kwargs[:username] ||= uri.user if uri.password && !uri.user.empty?
|
@@ -17,7 +17,7 @@ class RedisClient
|
|
17
17
|
write(command)
|
18
18
|
result = read(timeout)
|
19
19
|
@pending_reads -= 1
|
20
|
-
if result.is_a?(
|
20
|
+
if result.is_a?(Error)
|
21
21
|
result._set_command(command)
|
22
22
|
raise result
|
23
23
|
else
|
@@ -37,7 +37,7 @@ class RedisClient
|
|
37
37
|
timeout = timeouts && timeouts[index]
|
38
38
|
result = read(timeout)
|
39
39
|
@pending_reads -= 1
|
40
|
-
if result.is_a?(
|
40
|
+
if result.is_a?(Error)
|
41
41
|
result._set_command(commands[index])
|
42
42
|
exception ||= result
|
43
43
|
end
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
@@ -90,9 +90,17 @@ class RedisClient
|
|
90
90
|
WriteTimeoutError = Class.new(TimeoutError)
|
91
91
|
CheckoutTimeoutError = Class.new(TimeoutError)
|
92
92
|
|
93
|
-
|
93
|
+
module HasCommand
|
94
94
|
attr_reader :command
|
95
95
|
|
96
|
+
def _set_command(command)
|
97
|
+
@command = command
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class CommandError < Error
|
102
|
+
include HasCommand
|
103
|
+
|
96
104
|
class << self
|
97
105
|
def parse(error_message)
|
98
106
|
code = if error_message.start_with?("ERR Error running script")
|
@@ -107,18 +115,16 @@ class RedisClient
|
|
107
115
|
klass.new(error_message)
|
108
116
|
end
|
109
117
|
end
|
110
|
-
|
111
|
-
def _set_command(command)
|
112
|
-
@command = command
|
113
|
-
end
|
114
118
|
end
|
115
119
|
|
116
120
|
AuthenticationError = Class.new(CommandError)
|
117
121
|
PermissionError = Class.new(CommandError)
|
118
|
-
ReadOnlyError = Class.new(CommandError)
|
119
122
|
WrongTypeError = Class.new(CommandError)
|
120
123
|
OutOfMemoryError = Class.new(CommandError)
|
121
124
|
|
125
|
+
ReadOnlyError = Class.new(ConnectionError)
|
126
|
+
ReadOnlyError.include(HasCommand)
|
127
|
+
|
122
128
|
CommandError::ERRORS = {
|
123
129
|
"WRONGPASS" => AuthenticationError,
|
124
130
|
"NOPERM" => PermissionError,
|
@@ -686,9 +692,9 @@ class RedisClient
|
|
686
692
|
rescue ConnectionError => error
|
687
693
|
raise CannotConnectError, error.message, error.backtrace
|
688
694
|
rescue CommandError => error
|
689
|
-
if error.message.
|
695
|
+
if error.message.match?(/ERR unknown command ['`]HELLO['`]/)
|
690
696
|
raise UnsupportedServer,
|
691
|
-
"
|
697
|
+
"redis-client requires Redis 6+ with HELLO command available (#{config.server_url})"
|
692
698
|
else
|
693
699
|
raise
|
694
700
|
end
|
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.11.
|
4
|
+
version: 0.11.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-
|
11
|
+
date: 2022-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|