redis 4.2.2 → 4.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/redis.rb +9 -11
- data/lib/redis/connection/ruby.rb +51 -35
- data/lib/redis/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61aa8081d2ac045b1198082e263c54afc544dd70f4d53e6699465cebb9c7fbc5
|
4
|
+
data.tar.gz: cbcaf862e67025ea2fcefc6736b6cd7e9c5b5b81c2434871f7a01a70a94f618d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72fd55828b8ded96f92a2d4826b1351a2ffd86272d5d3bba204fe68559373b06b55386e78b83cdab74c32ca7f3c4392001e1c3c0a9fa53ef4c1a55ad1c027551
|
7
|
+
data.tar.gz: 10b17148f6bcfd9f4862c8fae33a9cd83d0b1849562dbb991f5a2a2047bb658d50c6bc4c9e794041d7cc8ef22b3c1ccf89586c37be9dcdd6d4170237e31fc110
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 4.2.3
|
4
|
+
|
5
|
+
* Use io/wait instead of IO.select in the ruby connector. See #960.
|
6
|
+
* Use exception free non blocking IOs in the ruby connector. See #926.
|
7
|
+
* Prevent corruption of the client when an interrupt happen during inside a pipeline block. See #945.
|
8
|
+
|
3
9
|
# 4.2.2
|
4
10
|
|
5
11
|
* Fix `WATCH` support for `Redis::Distributed`. See #941.
|
data/README.md
CHANGED
@@ -265,6 +265,7 @@ All timeout values are specified in seconds.
|
|
265
265
|
When using pub/sub, you can subscribe to a channel using a timeout as well:
|
266
266
|
|
267
267
|
```ruby
|
268
|
+
redis = Redis.new(reconnect_attempts: 0)
|
268
269
|
redis.subscribe_with_timeout(5, "news") do |on|
|
269
270
|
on.message do |channel, message|
|
270
271
|
# ...
|
data/lib/redis.rb
CHANGED
@@ -2438,14 +2438,13 @@ class Redis
|
|
2438
2438
|
end
|
2439
2439
|
|
2440
2440
|
def pipelined
|
2441
|
-
synchronize do |
|
2441
|
+
synchronize do |prior_client|
|
2442
2442
|
begin
|
2443
|
-
|
2444
|
-
original, @client = @client, pipeline
|
2443
|
+
@client = Pipeline.new(prior_client)
|
2445
2444
|
yield(self)
|
2446
|
-
|
2445
|
+
prior_client.call_pipeline(@client)
|
2447
2446
|
ensure
|
2448
|
-
@client =
|
2447
|
+
@client = prior_client
|
2449
2448
|
end
|
2450
2449
|
end
|
2451
2450
|
end
|
@@ -2481,17 +2480,16 @@ class Redis
|
|
2481
2480
|
# @see #watch
|
2482
2481
|
# @see #unwatch
|
2483
2482
|
def multi
|
2484
|
-
synchronize do |
|
2483
|
+
synchronize do |prior_client|
|
2485
2484
|
if !block_given?
|
2486
|
-
|
2485
|
+
prior_client.call([:multi])
|
2487
2486
|
else
|
2488
2487
|
begin
|
2489
|
-
|
2490
|
-
original, @client = @client, pipeline
|
2488
|
+
@client = Pipeline::Multi.new(prior_client)
|
2491
2489
|
yield(self)
|
2492
|
-
|
2490
|
+
prior_client.call_pipeline(@client)
|
2493
2491
|
ensure
|
2494
|
-
@client =
|
2492
|
+
@client = prior_client
|
2495
2493
|
end
|
2496
2494
|
end
|
2497
2495
|
end
|
@@ -49,43 +49,47 @@ class Redis
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def _read_from_socket(nbytes)
|
52
|
-
|
53
|
-
read_nonblock(nbytes)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
52
|
+
loop do
|
53
|
+
case chunk = read_nonblock(nbytes, exception: false)
|
54
|
+
when :wait_readable
|
55
|
+
unless wait_readable(@timeout)
|
56
|
+
raise Redis::TimeoutError
|
57
|
+
end
|
58
|
+
when :wait_writable
|
59
|
+
unless wait_writable(@timeout)
|
60
|
+
raise Redis::TimeoutError
|
61
|
+
end
|
62
|
+
when nil
|
63
|
+
raise Errno::ECONNRESET
|
64
|
+
when String
|
65
|
+
return chunk
|
65
66
|
end
|
66
67
|
end
|
67
|
-
rescue EOFError
|
68
|
-
raise Errno::ECONNRESET
|
69
68
|
end
|
70
69
|
|
71
70
|
def _write_to_socket(data)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
raise
|
71
|
+
total_bytes_written = 0
|
72
|
+
loop do
|
73
|
+
case bytes_written = write_nonblock(data, exception: false)
|
74
|
+
when :wait_readable
|
75
|
+
unless wait_readable(@write_timeout)
|
76
|
+
raise Redis::TimeoutError
|
77
|
+
end
|
78
|
+
when :wait_writable
|
79
|
+
unless wait_writable(@write_timeout)
|
80
|
+
raise Redis::TimeoutError
|
81
|
+
end
|
82
|
+
when nil
|
83
|
+
raise Errno::ECONNRESET
|
84
|
+
when Integer
|
85
|
+
total_bytes_written += bytes_written
|
86
|
+
if bytes_written < data.bytesize
|
87
|
+
data.slice!(0, bytes_written)
|
88
|
+
else
|
89
|
+
return total_bytes_written
|
90
|
+
end
|
85
91
|
end
|
86
92
|
end
|
87
|
-
rescue EOFError
|
88
|
-
raise Errno::ECONNRESET
|
89
93
|
end
|
90
94
|
|
91
95
|
def write(data)
|
@@ -135,7 +139,7 @@ class Redis
|
|
135
139
|
raise TimeoutError
|
136
140
|
end
|
137
141
|
|
138
|
-
# JRuby raises Errno::EAGAIN on #read_nonblock even when
|
142
|
+
# JRuby raises Errno::EAGAIN on #read_nonblock even when it
|
139
143
|
# says it is readable (1.6.6, in both 1.8 and 1.9 mode).
|
140
144
|
# Use the blocking #readpartial method instead.
|
141
145
|
|
@@ -160,7 +164,7 @@ class Redis
|
|
160
164
|
begin
|
161
165
|
sock.connect_nonblock(sockaddr)
|
162
166
|
rescue Errno::EINPROGRESS
|
163
|
-
raise TimeoutError
|
167
|
+
raise TimeoutError unless sock.wait_writable(timeout)
|
164
168
|
|
165
169
|
begin
|
166
170
|
sock.connect_nonblock(sockaddr)
|
@@ -215,7 +219,7 @@ class Redis
|
|
215
219
|
begin
|
216
220
|
sock.connect_nonblock(sockaddr)
|
217
221
|
rescue Errno::EINPROGRESS
|
218
|
-
raise TimeoutError
|
222
|
+
raise TimeoutError unless sock.wait_writable(timeout)
|
219
223
|
|
220
224
|
begin
|
221
225
|
sock.connect_nonblock(sockaddr)
|
@@ -233,6 +237,18 @@ class Redis
|
|
233
237
|
class SSLSocket < ::OpenSSL::SSL::SSLSocket
|
234
238
|
include SocketMixin
|
235
239
|
|
240
|
+
unless method_defined?(:wait_readable)
|
241
|
+
def wait_readable(timeout = nil)
|
242
|
+
to_io.wait_readable(timeout)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
unless method_defined?(:wait_writable)
|
247
|
+
def wait_writable(timeout = nil)
|
248
|
+
to_io.wait_writable(timeout)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
236
252
|
def self.connect(host, port, timeout, ssl_params)
|
237
253
|
# Note: this is using Redis::Connection::TCPSocket
|
238
254
|
tcp_sock = TCPSocket.connect(host, port, timeout)
|
@@ -254,13 +270,13 @@ class Redis
|
|
254
270
|
# Instead, you have to retry.
|
255
271
|
ssl_sock.connect_nonblock
|
256
272
|
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
|
257
|
-
if
|
273
|
+
if ssl_sock.wait_readable(timeout)
|
258
274
|
retry
|
259
275
|
else
|
260
276
|
raise TimeoutError
|
261
277
|
end
|
262
278
|
rescue IO::WaitWritable
|
263
|
-
if
|
279
|
+
if ssl_sock.wait_writable(timeout)
|
264
280
|
retry
|
265
281
|
else
|
266
282
|
raise TimeoutError
|
data/lib/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2020-
|
19
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: em-synchrony
|
@@ -102,9 +102,9 @@ licenses:
|
|
102
102
|
metadata:
|
103
103
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
104
104
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
|
105
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/4.2.
|
105
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/4.2.3
|
106
106
|
homepage_uri: https://github.com/redis/redis-rb
|
107
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/v4.2.
|
107
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v4.2.3
|
108
108
|
post_install_message:
|
109
109
|
rdoc_options: []
|
110
110
|
require_paths:
|