redis 3.3.1 → 3.3.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 +6 -0
- data/lib/redis.rb +8 -3
- data/lib/redis/connection/ruby.rb +20 -4
- data/lib/redis/distributed.rb +2 -2
- data/lib/redis/version.rb +1 -1
- data/test/lint/sets.rb +15 -0
- data/test/ssl_test.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d74bd71d0e30d7a582b6840b4aaa45790a4a2a05
|
|
4
|
+
data.tar.gz: 8652e243304b3fba9f041bb7ea6c85b46e54f6a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c82eb96fce806b42775e86655c4a7fdf8dc87a728ee3998c67c9f5fd45c32ac8f618f14f4c7700106e8258901288e53c9b5612e0ba8ab8e089f758cf053b1e7f
|
|
7
|
+
data.tar.gz: 1a85694ea7fced9e4c0521a1d9d081d96a02e63fe8c9455af9a5d4be7858de3576fddc869939974bac1b1143ec9592d03a60165e7d1b75a2af8ea8f060b55ef2
|
data/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
security updates in June of 2013; continuing to support it would prevent
|
|
13
13
|
the use of newer features of Ruby.
|
|
14
14
|
|
|
15
|
+
# 3.3.2
|
|
16
|
+
|
|
17
|
+
* Added support for SPOP with COUNT. See #628.
|
|
18
|
+
|
|
19
|
+
* Fixed connection glitches when using SSL. See #644.
|
|
20
|
+
|
|
15
21
|
# 3.3.1
|
|
16
22
|
|
|
17
23
|
* Remove usage of Timeout::timeout, refactor into using low level non-blocking writes.
|
data/lib/redis.rb
CHANGED
|
@@ -1336,13 +1336,18 @@ class Redis
|
|
|
1336
1336
|
end
|
|
1337
1337
|
end
|
|
1338
1338
|
|
|
1339
|
-
# Remove and return
|
|
1339
|
+
# Remove and return one or more random member from a set.
|
|
1340
1340
|
#
|
|
1341
1341
|
# @param [String] key
|
|
1342
1342
|
# @return [String]
|
|
1343
|
-
|
|
1343
|
+
# @param [Fixnum] count
|
|
1344
|
+
def spop(key, count = nil)
|
|
1344
1345
|
synchronize do |client|
|
|
1345
|
-
|
|
1346
|
+
if count.nil?
|
|
1347
|
+
client.call([:spop, key])
|
|
1348
|
+
else
|
|
1349
|
+
client.call([:spop, key, count])
|
|
1350
|
+
end
|
|
1346
1351
|
end
|
|
1347
1352
|
end
|
|
1348
1353
|
|
|
@@ -27,8 +27,12 @@ class Redis
|
|
|
27
27
|
CRLF = "\r\n".freeze
|
|
28
28
|
|
|
29
29
|
# Exceptions raised during non-blocking I/O ops that require retrying the op
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
NBIO_READ_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
|
|
31
|
+
NBIO_WRITE_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
|
|
32
|
+
if RUBY_VERSION >= "1.9.3"
|
|
33
|
+
NBIO_READ_EXCEPTIONS << IO::WaitReadable
|
|
34
|
+
NBIO_WRITE_EXCEPTIONS << IO::WaitWritable
|
|
35
|
+
end
|
|
32
36
|
|
|
33
37
|
def initialize(*args)
|
|
34
38
|
super(*args)
|
|
@@ -78,12 +82,18 @@ class Redis
|
|
|
78
82
|
begin
|
|
79
83
|
read_nonblock(nbytes)
|
|
80
84
|
|
|
81
|
-
rescue *
|
|
85
|
+
rescue *NBIO_READ_EXCEPTIONS
|
|
82
86
|
if IO.select([self], nil, nil, @timeout)
|
|
83
87
|
retry
|
|
84
88
|
else
|
|
85
89
|
raise Redis::TimeoutError
|
|
86
90
|
end
|
|
91
|
+
rescue *NBIO_WRITE_EXCEPTIONS
|
|
92
|
+
if IO.select(nil, [self], nil, @timeout)
|
|
93
|
+
retry
|
|
94
|
+
else
|
|
95
|
+
raise Redis::TimeoutError
|
|
96
|
+
end
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
rescue EOFError
|
|
@@ -94,7 +104,13 @@ class Redis
|
|
|
94
104
|
begin
|
|
95
105
|
write_nonblock(data)
|
|
96
106
|
|
|
97
|
-
rescue *
|
|
107
|
+
rescue *NBIO_READ_EXCEPTIONS
|
|
108
|
+
if IO.select([self], nil, nil, @write_timeout)
|
|
109
|
+
retry
|
|
110
|
+
else
|
|
111
|
+
raise Redis::TimeoutError
|
|
112
|
+
end
|
|
113
|
+
rescue *NBIO_WRITE_EXCEPTIONS
|
|
98
114
|
if IO.select(nil, [self], nil, @write_timeout)
|
|
99
115
|
retry
|
|
100
116
|
else
|
data/lib/redis/distributed.rb
CHANGED
data/lib/redis/version.rb
CHANGED
data/test/lint/sets.rb
CHANGED
|
@@ -52,6 +52,21 @@ module Lint
|
|
|
52
52
|
assert_equal nil, r.spop("foo")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
def test_spop_with_positive_count
|
|
56
|
+
target_version "3.2.0" do
|
|
57
|
+
r.sadd "foo", "s1"
|
|
58
|
+
r.sadd "foo", "s2"
|
|
59
|
+
r.sadd "foo", "s3"
|
|
60
|
+
r.sadd "foo", "s4"
|
|
61
|
+
|
|
62
|
+
pops = r.spop("foo", 3)
|
|
63
|
+
|
|
64
|
+
assert !(["s1", "s2", "s3", "s4"] & pops).empty?
|
|
65
|
+
assert_equal 3, pops.size
|
|
66
|
+
assert_equal 1, r.scard("foo")
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
55
70
|
def test_scard
|
|
56
71
|
assert_equal 0, r.scard("foo")
|
|
57
72
|
|
data/test/ssl_test.rb
CHANGED
|
@@ -25,6 +25,13 @@ if RUBY_VERSION >= "1.9.3"
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def test_ssl_blocking
|
|
29
|
+
RedisMock.start({}, ssl_server_opts("trusted")) do |port|
|
|
30
|
+
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
|
31
|
+
assert_equal redis.set("boom", "a" * 10_000_000), "OK"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
end
|
|
29
36
|
|
|
30
37
|
driver(:hiredis, :synchrony) do
|
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: 3.3.
|
|
4
|
+
version: 3.3.2
|
|
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: 2016-
|
|
19
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
22
|
name: rake
|