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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4744291b8bc26230044fc12c456951a60c5802c7
4
- data.tar.gz: 6eabe9bb60b74aa2408007a72f9a44e831b71a5e
3
+ metadata.gz: d74bd71d0e30d7a582b6840b4aaa45790a4a2a05
4
+ data.tar.gz: 8652e243304b3fba9f041bb7ea6c85b46e54f6a1
5
5
  SHA512:
6
- metadata.gz: 7fb460a3595ed430dbf4dab6f516dcbef029cf1c72350e4e50b7e425e8d94b8d47760d33f58db21bad95852ec97fa7fdba55cfb0858292c221c947516a291f97
7
- data.tar.gz: 7cdf461c39d5eede9b295bf987391cd70461cd5adcee945ae243d509f67457ea14aa0ad08ca47efdab8bb8ca315d6bdff94460d6cecc6b981f459081cd93dfbd
6
+ metadata.gz: c82eb96fce806b42775e86655c4a7fdf8dc87a728ee3998c67c9f5fd45c32ac8f618f14f4c7700106e8258901288e53c9b5612e0ba8ab8e089f758cf053b1e7f
7
+ data.tar.gz: 1a85694ea7fced9e4c0521a1d9d081d96a02e63fe8c9455af9a5d4be7858de3576fddc869939974bac1b1143ec9592d03a60165e7d1b75a2af8ea8f060b55ef2
@@ -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.
@@ -1336,13 +1336,18 @@ class Redis
1336
1336
  end
1337
1337
  end
1338
1338
 
1339
- # Remove and return a random member from a set.
1339
+ # Remove and return one or more random member from a set.
1340
1340
  #
1341
1341
  # @param [String] key
1342
1342
  # @return [String]
1343
- def spop(key)
1343
+ # @param [Fixnum] count
1344
+ def spop(key, count = nil)
1344
1345
  synchronize do |client|
1345
- client.call([:spop, key])
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
- NBIO_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
31
- NBIO_EXCEPTIONS << IO::WaitReadable if RUBY_VERSION >= "1.9.3"
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 *NBIO_EXCEPTIONS
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 *NBIO_EXCEPTIONS
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
@@ -483,8 +483,8 @@ class Redis
483
483
  end
484
484
 
485
485
  # Remove and return a random member from a set.
486
- def spop(key)
487
- node_for(key).spop(key)
486
+ def spop(key, count = nil)
487
+ node_for(key).spop(key, count)
488
488
  end
489
489
 
490
490
  # Get a random member from a set.
@@ -1,3 +1,3 @@
1
1
  class Redis
2
- VERSION = "3.3.1"
2
+ VERSION = "3.3.2"
3
3
  end
@@ -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
 
@@ -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.1
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-07-18 00:00:00.000000000 Z
19
+ date: 2016-11-17 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rake