redis 5.0.0.beta3 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -2
- data/README.md +2 -4
- data/lib/redis/commands/geo.rb +3 -3
- data/lib/redis/commands/hashes.rb +2 -2
- data/lib/redis/commands/keys.rb +1 -1
- data/lib/redis/commands/lists.rb +9 -9
- data/lib/redis/commands/pubsub.rb +6 -22
- data/lib/redis/commands/server.rb +1 -1
- data/lib/redis/commands/sets.rb +1 -1
- data/lib/redis/commands/sorted_sets.rb +14 -10
- data/lib/redis/commands/strings.rb +13 -13
- data/lib/redis/distributed.rb +1 -1
- data/lib/redis/errors.rb +3 -0
- data/lib/redis/subscribe.rb +9 -7
- data/lib/redis/version.rb +1 -1
- data/lib/redis.rb +29 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10ad63f47810f1479a1b36fa446a48220570841059a262d803bd837834f25f15
|
4
|
+
data.tar.gz: 78bf177db823e73c022d56f1582b2043155ff4ba0171c7e8857114689f34336a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17705fee83bdf111cc886b96cd499d9244b126b3676d46422964a927cf2bbbbb297cd349a881fb1dc70dc7033e96a50308825e1f6b6ef23b17ba34a3f3288548
|
7
|
+
data.tar.gz: 5601c8ac88f83f5b178114985ef0719ff94514e265c85542f1a1269000261608dae3a9c4c63ba90263eb2c48df20f13fdb035fdf83e9e011b0fbba7ea818d774
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
-
# 5.0.
|
3
|
+
# 5.0.1
|
4
4
|
|
5
|
+
- Added a fake `Redis::Connections.drivers` method to be compatible with older sidekiq versions.
|
6
|
+
|
7
|
+
# 5.0.0
|
8
|
+
|
9
|
+
- Eagerly and strictly cast Integer and Float parameters.
|
10
|
+
- Allow to call `subscribe`, `unsubscribe`, `psubscribe` and `punsubscribe` from a subscribed client. See #1131.
|
5
11
|
- Use `MD5` for hashing server nodes in `Redis::Distributed`. This should improve keys distribution among servers. See #1089.
|
6
12
|
- Changed `sadd` and `srem` to now always return an Integer.
|
7
13
|
- Added `sadd?` and `srem?` which always return a Boolean.
|
8
14
|
- Added support for `IDLE` paramter in `xpending`.
|
9
|
-
- Cluster support has been moved to a `
|
15
|
+
- Cluster support has been moved to a `redis-clustering` companion gem.
|
10
16
|
- `select` no longer record the current database. If the client has to reconnect after `select` was used, it will reconnect to the original database.
|
11
17
|
- Better support Float timeout in blocking commands. See #977.
|
12
18
|
- Removed positional timeout in blocking commands (`BLPOP`, etc). Timeout now must be passed as an option: `r.blpop("key", timeout: 2.5)`
|
@@ -21,6 +27,13 @@
|
|
21
27
|
- Removed the `synchrony` driver.
|
22
28
|
- Removed `Redis.exists_returns_integer`, it's now always enabled.
|
23
29
|
|
30
|
+
# 4.8.0
|
31
|
+
|
32
|
+
* Introduce `sadd?` and `srem?` as boolean returning versions of `sadd` and `srem`.
|
33
|
+
* Deprecate `sadd` and `srem` returning a boolean when called with a single argument.
|
34
|
+
To enable the redis 5.0 behavior you can set `Redis.sadd_returns_boolean = true`.
|
35
|
+
* Deprecate passing `timeout` as a positional argument in blocking commands (`brpop`, `blop`, etc).
|
36
|
+
|
24
37
|
# 4.7.1
|
25
38
|
|
26
39
|
* Gracefully handle OpenSSL 3.0 EOF Errors (`OpenSSL::SSL::SSLError: SSL_read: unexpected eof while reading`). See #1106
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ The client does not provide connection pooling. Each `Redis` instance
|
|
77
77
|
has one and only one connection to the server, and use of this connection
|
78
78
|
is protected by a mutex.
|
79
79
|
|
80
|
-
As such it is heavilly recommended to use the [`connection_pool` gem], e.g.:
|
80
|
+
As such it is heavilly recommended to use the [`connection_pool` gem](https://github.com/mperham/connection_pool), e.g.:
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
module MyApp
|
@@ -91,8 +91,6 @@ end
|
|
91
91
|
MyApp.redis.incr("some-counter")
|
92
92
|
```
|
93
93
|
|
94
|
-
[`connection_pool` gem](https://github.com/mperham/connection_pool)
|
95
|
-
|
96
94
|
## Sentinel support
|
97
95
|
|
98
96
|
The client is able to perform automatic failover by using [Redis
|
@@ -157,7 +155,7 @@ end
|
|
157
155
|
```
|
158
156
|
|
159
157
|
Commands must be called on the yielded objects. If you call methods
|
160
|
-
on the original client objects from inside a pipeline, they
|
158
|
+
on the original client objects from inside a pipeline, they will be sent immediately:
|
161
159
|
|
162
160
|
```ruby
|
163
161
|
redis.pipelined do |pipeline|
|
data/lib/redis/commands/geo.rb
CHANGED
@@ -74,9 +74,9 @@ class Redis
|
|
74
74
|
private
|
75
75
|
|
76
76
|
def _geoarguments(*args, options: nil, sort: nil, count: nil)
|
77
|
-
args
|
78
|
-
args
|
79
|
-
args
|
77
|
+
args << sort if sort
|
78
|
+
args << 'COUNT' << Integer(count) if count
|
79
|
+
args << options if options
|
80
80
|
args
|
81
81
|
end
|
82
82
|
end
|
@@ -174,7 +174,7 @@ class Redis
|
|
174
174
|
# @param [Integer] increment
|
175
175
|
# @return [Integer] value of the field after incrementing it
|
176
176
|
def hincrby(key, field, increment)
|
177
|
-
send_command([:hincrby, key, field, increment])
|
177
|
+
send_command([:hincrby, key, field, Integer(increment)])
|
178
178
|
end
|
179
179
|
|
180
180
|
# Increment the numeric value of a hash field by the given float number.
|
@@ -184,7 +184,7 @@ class Redis
|
|
184
184
|
# @param [Float] increment
|
185
185
|
# @return [Float] value of the field after incrementing it
|
186
186
|
def hincrbyfloat(key, field, increment)
|
187
|
-
send_command([:hincrbyfloat, key, field, increment], &Floatify)
|
187
|
+
send_command([:hincrbyfloat, key, field, Float(increment)], &Floatify)
|
188
188
|
end
|
189
189
|
|
190
190
|
# Get all the fields in a hash.
|
data/lib/redis/commands/keys.rb
CHANGED
data/lib/redis/commands/lists.rb
CHANGED
@@ -99,10 +99,10 @@ class Redis
|
|
99
99
|
#
|
100
100
|
# @param [String] key
|
101
101
|
# @param [Integer] count number of elements to remove
|
102
|
-
# @return [String, Array<String>] the values of the first elements
|
102
|
+
# @return [nil, String, Array<String>] the values of the first elements
|
103
103
|
def lpop(key, count = nil)
|
104
104
|
command = [:lpop, key]
|
105
|
-
command << count if count
|
105
|
+
command << Integer(count) if count
|
106
106
|
send_command(command)
|
107
107
|
end
|
108
108
|
|
@@ -110,10 +110,10 @@ class Redis
|
|
110
110
|
#
|
111
111
|
# @param [String] key
|
112
112
|
# @param [Integer] count number of elements to remove
|
113
|
-
# @return [String, Array<String>] the values of the last elements
|
113
|
+
# @return [nil, String, Array<String>] the values of the last elements
|
114
114
|
def rpop(key, count = nil)
|
115
115
|
command = [:rpop, key]
|
116
|
-
command << count if count
|
116
|
+
command << Integer(count) if count
|
117
117
|
send_command(command)
|
118
118
|
end
|
119
119
|
|
@@ -189,7 +189,7 @@ class Redis
|
|
189
189
|
# @param [Integer] index
|
190
190
|
# @return [String]
|
191
191
|
def lindex(key, index)
|
192
|
-
send_command([:lindex, key, index])
|
192
|
+
send_command([:lindex, key, Integer(index)])
|
193
193
|
end
|
194
194
|
|
195
195
|
# Insert an element before or after another element in a list.
|
@@ -211,7 +211,7 @@ class Redis
|
|
211
211
|
# @param [Integer] stop stop index
|
212
212
|
# @return [Array<String>]
|
213
213
|
def lrange(key, start, stop)
|
214
|
-
send_command([:lrange, key, start, stop])
|
214
|
+
send_command([:lrange, key, Integer(start), Integer(stop)])
|
215
215
|
end
|
216
216
|
|
217
217
|
# Remove elements from a list.
|
@@ -224,7 +224,7 @@ class Redis
|
|
224
224
|
# @param [String] value
|
225
225
|
# @return [Integer] the number of removed elements
|
226
226
|
def lrem(key, count, value)
|
227
|
-
send_command([:lrem, key, count, value])
|
227
|
+
send_command([:lrem, key, Integer(count), value])
|
228
228
|
end
|
229
229
|
|
230
230
|
# Set the value of an element in a list by its index.
|
@@ -234,7 +234,7 @@ class Redis
|
|
234
234
|
# @param [String] value
|
235
235
|
# @return [String] `OK`
|
236
236
|
def lset(key, index, value)
|
237
|
-
send_command([:lset, key, index, value])
|
237
|
+
send_command([:lset, key, Integer(index), value])
|
238
238
|
end
|
239
239
|
|
240
240
|
# Trim a list to the specified range.
|
@@ -244,7 +244,7 @@ class Redis
|
|
244
244
|
# @param [Integer] stop stop index
|
245
245
|
# @return [String] `OK`
|
246
246
|
def ltrim(key, start, stop)
|
247
|
-
send_command([:ltrim, key, start, stop])
|
247
|
+
send_command([:ltrim, key, Integer(start), Integer(stop)])
|
248
248
|
end
|
249
249
|
|
250
250
|
private
|
@@ -14,50 +14,34 @@ class Redis
|
|
14
14
|
|
15
15
|
# Listen for messages published to the given channels.
|
16
16
|
def subscribe(*channels, &block)
|
17
|
-
|
18
|
-
_subscription(:subscribe, 0, channels, block)
|
19
|
-
end
|
17
|
+
_subscription(:subscribe, 0, channels, block)
|
20
18
|
end
|
21
19
|
|
22
20
|
# Listen for messages published to the given channels. Throw a timeout error
|
23
21
|
# if there is no messages for a timeout period.
|
24
22
|
def subscribe_with_timeout(timeout, *channels, &block)
|
25
|
-
|
26
|
-
_subscription(:subscribe_with_timeout, timeout, channels, block)
|
27
|
-
end
|
23
|
+
_subscription(:subscribe_with_timeout, timeout, channels, block)
|
28
24
|
end
|
29
25
|
|
30
26
|
# Stop listening for messages posted to the given channels.
|
31
27
|
def unsubscribe(*channels)
|
32
|
-
|
33
|
-
|
34
|
-
synchronize do |_client|
|
35
|
-
_subscription(:unsubscribe, 0, channels, nil)
|
36
|
-
end
|
28
|
+
_subscription(:unsubscribe, 0, channels, nil)
|
37
29
|
end
|
38
30
|
|
39
31
|
# Listen for messages published to channels matching the given patterns.
|
40
32
|
def psubscribe(*channels, &block)
|
41
|
-
|
42
|
-
_subscription(:psubscribe, 0, channels, block)
|
43
|
-
end
|
33
|
+
_subscription(:psubscribe, 0, channels, block)
|
44
34
|
end
|
45
35
|
|
46
36
|
# Listen for messages published to channels matching the given patterns.
|
47
37
|
# Throw a timeout error if there is no messages for a timeout period.
|
48
38
|
def psubscribe_with_timeout(timeout, *channels, &block)
|
49
|
-
|
50
|
-
_subscription(:psubscribe_with_timeout, timeout, channels, block)
|
51
|
-
end
|
39
|
+
_subscription(:psubscribe_with_timeout, timeout, channels, block)
|
52
40
|
end
|
53
41
|
|
54
42
|
# Stop listening for messages posted to channels matching the given patterns.
|
55
43
|
def punsubscribe(*channels)
|
56
|
-
|
57
|
-
|
58
|
-
synchronize do |_client|
|
59
|
-
_subscription(:punsubscribe, 0, channels, nil)
|
60
|
-
end
|
44
|
+
_subscription(:punsubscribe, 0, channels, nil)
|
61
45
|
end
|
62
46
|
|
63
47
|
# Inspect the state of the Pub/Sub subsystem.
|
@@ -158,7 +158,7 @@ class Redis
|
|
158
158
|
# @return [Array<String>, Integer, String] depends on subcommand
|
159
159
|
def slowlog(subcommand, length = nil)
|
160
160
|
args = [:slowlog, subcommand]
|
161
|
-
args << length if length
|
161
|
+
args << Integer(length) if length
|
162
162
|
send_command(args)
|
163
163
|
end
|
164
164
|
|
data/lib/redis/commands/sets.rb
CHANGED
@@ -136,7 +136,9 @@ class Redis
|
|
136
136
|
# @return [Array<String, Float>] element and score pair if count is not specified
|
137
137
|
# @return [Array<Array<String, Float>>] list of popped elements and scores
|
138
138
|
def zpopmax(key, count = nil)
|
139
|
-
|
139
|
+
command = [:zpopmax, key]
|
140
|
+
command << Integer(count) if count
|
141
|
+
send_command(command) do |members|
|
140
142
|
members = FloatifyPairs.call(members)
|
141
143
|
count.to_i > 1 ? members : members.first
|
142
144
|
end
|
@@ -157,7 +159,9 @@ class Redis
|
|
157
159
|
# @return [Array<String, Float>] element and score pair if count is not specified
|
158
160
|
# @return [Array<Array<String, Float>>] list of popped elements and scores
|
159
161
|
def zpopmin(key, count = nil)
|
160
|
-
|
162
|
+
command = [:zpopmin, key]
|
163
|
+
command << Integer(count) if count
|
164
|
+
send_command(command) do |members|
|
161
165
|
members = FloatifyPairs.call(members)
|
162
166
|
count.to_i > 1 ? members : members.first
|
163
167
|
end
|
@@ -261,7 +265,7 @@ class Redis
|
|
261
265
|
end
|
262
266
|
|
263
267
|
args = [:zrandmember, key]
|
264
|
-
args << count if count
|
268
|
+
args << Integer(count) if count
|
265
269
|
|
266
270
|
if with_scores
|
267
271
|
args << "WITHSCORES"
|
@@ -313,7 +317,7 @@ class Redis
|
|
313
317
|
|
314
318
|
if limit
|
315
319
|
args << "LIMIT"
|
316
|
-
args.concat(limit)
|
320
|
+
args.concat(limit.map { |l| Integer(l) })
|
317
321
|
end
|
318
322
|
|
319
323
|
if with_scores
|
@@ -354,7 +358,7 @@ class Redis
|
|
354
358
|
|
355
359
|
if limit
|
356
360
|
args << "LIMIT"
|
357
|
-
args.concat(limit)
|
361
|
+
args.concat(limit.map { |l| Integer(l) })
|
358
362
|
end
|
359
363
|
|
360
364
|
send_command(args)
|
@@ -372,7 +376,7 @@ class Redis
|
|
372
376
|
#
|
373
377
|
# @see #zrange
|
374
378
|
def zrevrange(key, start, stop, withscores: false, with_scores: withscores)
|
375
|
-
args = [:zrevrange, key, start, stop]
|
379
|
+
args = [:zrevrange, key, Integer(start), Integer(stop)]
|
376
380
|
|
377
381
|
if with_scores
|
378
382
|
args << "WITHSCORES"
|
@@ -466,7 +470,7 @@ class Redis
|
|
466
470
|
|
467
471
|
if limit
|
468
472
|
args << "LIMIT"
|
469
|
-
args.concat(limit)
|
473
|
+
args.concat(limit.map { |l| Integer(l) })
|
470
474
|
end
|
471
475
|
|
472
476
|
send_command(args)
|
@@ -488,7 +492,7 @@ class Redis
|
|
488
492
|
|
489
493
|
if limit
|
490
494
|
args << "LIMIT"
|
491
|
-
args.concat(limit)
|
495
|
+
args.concat(limit.map { |l| Integer(l) })
|
492
496
|
end
|
493
497
|
|
494
498
|
send_command(args)
|
@@ -531,7 +535,7 @@ class Redis
|
|
531
535
|
|
532
536
|
if limit
|
533
537
|
args << "LIMIT"
|
534
|
-
args.concat(limit)
|
538
|
+
args.concat(limit.map { |l| Integer(l) })
|
535
539
|
end
|
536
540
|
|
537
541
|
send_command(args, &block)
|
@@ -561,7 +565,7 @@ class Redis
|
|
561
565
|
|
562
566
|
if limit
|
563
567
|
args << "LIMIT"
|
564
|
-
args.concat(limit)
|
568
|
+
args.concat(limit.map { |l| Integer(l) })
|
565
569
|
end
|
566
570
|
|
567
571
|
send_command(args, &block)
|
@@ -25,7 +25,7 @@ class Redis
|
|
25
25
|
# @param [Integer] decrement
|
26
26
|
# @return [Integer] value after decrementing it
|
27
27
|
def decrby(key, decrement)
|
28
|
-
send_command([:decrby, key, decrement])
|
28
|
+
send_command([:decrby, key, Integer(decrement)])
|
29
29
|
end
|
30
30
|
|
31
31
|
# Increment the integer value of a key by one.
|
@@ -50,7 +50,7 @@ class Redis
|
|
50
50
|
# @param [Integer] increment
|
51
51
|
# @return [Integer] value after incrementing it
|
52
52
|
def incrby(key, increment)
|
53
|
-
send_command([:incrby, key, increment])
|
53
|
+
send_command([:incrby, key, Integer(increment)])
|
54
54
|
end
|
55
55
|
|
56
56
|
# Increment the numeric value of a key by the given float number.
|
@@ -63,7 +63,7 @@ class Redis
|
|
63
63
|
# @param [Float] increment
|
64
64
|
# @return [Float] value after incrementing it
|
65
65
|
def incrbyfloat(key, increment)
|
66
|
-
send_command([:incrbyfloat, key, increment], &Floatify)
|
66
|
+
send_command([:incrbyfloat, key, Float(increment)], &Floatify)
|
67
67
|
end
|
68
68
|
|
69
69
|
# Set the string value of a key.
|
@@ -82,10 +82,10 @@ class Redis
|
|
82
82
|
# @return [String, Boolean] `"OK"` or true, false if `:nx => true` or `:xx => true`
|
83
83
|
def set(key, value, ex: nil, px: nil, exat: nil, pxat: nil, nx: nil, xx: nil, keepttl: nil, get: nil)
|
84
84
|
args = [:set, key, value.to_s]
|
85
|
-
args << "EX" << ex if ex
|
86
|
-
args << "PX" << px if px
|
87
|
-
args << "EXAT" << exat if exat
|
88
|
-
args << "PXAT" << pxat if pxat
|
85
|
+
args << "EX" << Integer(ex) if ex
|
86
|
+
args << "PX" << Integer(px) if px
|
87
|
+
args << "EXAT" << Integer(exat) if exat
|
88
|
+
args << "PXAT" << Integer(pxat) if pxat
|
89
89
|
args << "NX" if nx
|
90
90
|
args << "XX" if xx
|
91
91
|
args << "KEEPTTL" if keepttl
|
@@ -233,7 +233,7 @@ class Redis
|
|
233
233
|
# @param [String] value
|
234
234
|
# @return [Integer] length of the string after it was modified
|
235
235
|
def setrange(key, offset, value)
|
236
|
-
send_command([:setrange, key, offset, value.to_s])
|
236
|
+
send_command([:setrange, key, Integer(offset), value.to_s])
|
237
237
|
end
|
238
238
|
|
239
239
|
# Get a substring of the string stored at a key.
|
@@ -244,7 +244,7 @@ class Redis
|
|
244
244
|
# the end of the string
|
245
245
|
# @return [Integer] `0` or `1`
|
246
246
|
def getrange(key, start, stop)
|
247
|
-
send_command([:getrange, key, start, stop])
|
247
|
+
send_command([:getrange, key, Integer(start), Integer(stop)])
|
248
248
|
end
|
249
249
|
|
250
250
|
# Append a value to a key.
|
@@ -292,10 +292,10 @@ class Redis
|
|
292
292
|
# @return [String] The value of key, or nil when key does not exist.
|
293
293
|
def getex(key, ex: nil, px: nil, exat: nil, pxat: nil, persist: false)
|
294
294
|
args = [:getex, key]
|
295
|
-
args << "EX" << ex if ex
|
296
|
-
args << "PX" << px if px
|
297
|
-
args << "EXAT" << exat if exat
|
298
|
-
args << "PXAT" << pxat if pxat
|
295
|
+
args << "EX" << Integer(ex) if ex
|
296
|
+
args << "PX" << Integer(px) if px
|
297
|
+
args << "EXAT" << Integer(exat) if exat
|
298
|
+
args << "PXAT" << Integer(pxat) if pxat
|
299
299
|
args << "PERSIST" if persist
|
300
300
|
|
301
301
|
send_command(args)
|
data/lib/redis/distributed.rb
CHANGED
@@ -904,7 +904,7 @@ class Redis
|
|
904
904
|
|
905
905
|
# Stop listening for messages posted to the given channels.
|
906
906
|
def unsubscribe(*channels)
|
907
|
-
raise "Can't unsubscribe if not subscribed." unless subscribed?
|
907
|
+
raise SubscriptionError, "Can't unsubscribe if not subscribed." unless subscribed?
|
908
908
|
|
909
909
|
@subscribed_node.unsubscribe(*channels)
|
910
910
|
end
|
data/lib/redis/errors.rb
CHANGED
data/lib/redis/subscribe.rb
CHANGED
@@ -4,10 +4,13 @@ class Redis
|
|
4
4
|
class SubscribedClient
|
5
5
|
def initialize(client)
|
6
6
|
@client = client
|
7
|
+
@write_monitor = Monitor.new
|
7
8
|
end
|
8
9
|
|
9
10
|
def call_v(command)
|
10
|
-
@
|
11
|
+
@write_monitor.synchronize do
|
12
|
+
@client.call_v(command)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
def subscribe(*channels, &block)
|
@@ -43,14 +46,16 @@ class Redis
|
|
43
46
|
def subscription(start, stop, channels, block, timeout = 0)
|
44
47
|
sub = Subscription.new(&block)
|
45
48
|
|
46
|
-
|
49
|
+
call_v([start, *channels])
|
47
50
|
while event = @client.next_event(timeout)
|
48
51
|
if event.is_a?(::RedisClient::CommandError)
|
49
52
|
raise Client::ERROR_MAPPING.fetch(event.class), event.message
|
50
53
|
end
|
51
54
|
|
52
55
|
type, *rest = event
|
53
|
-
sub.callbacks[type]
|
56
|
+
if callback = sub.callbacks[type]
|
57
|
+
callback.call(*rest)
|
58
|
+
end
|
54
59
|
break if type == stop && rest.last == 0
|
55
60
|
end
|
56
61
|
# No need to unsubscribe here. The real client closes the connection
|
@@ -62,10 +67,7 @@ class Redis
|
|
62
67
|
attr :callbacks
|
63
68
|
|
64
69
|
def initialize
|
65
|
-
@callbacks =
|
66
|
-
hash[key] = ->(*_) {}
|
67
|
-
end
|
68
|
-
|
70
|
+
@callbacks = {}
|
69
71
|
yield(self)
|
70
72
|
end
|
71
73
|
|
data/lib/redis/version.rb
CHANGED
data/lib/redis.rb
CHANGED
@@ -22,6 +22,16 @@ class Redis
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# soft-deprecated
|
26
|
+
# We added this back for older sidekiq releases
|
27
|
+
module Connection
|
28
|
+
class << self
|
29
|
+
def drivers
|
30
|
+
[RedisClient.default_driver]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
25
35
|
include Commands
|
26
36
|
|
27
37
|
SERVER_URL_OPTIONS = %i(url host port path).freeze
|
@@ -165,19 +175,27 @@ class Redis
|
|
165
175
|
end
|
166
176
|
|
167
177
|
def _subscription(method, timeout, channels, block)
|
168
|
-
if
|
169
|
-
|
170
|
-
|
178
|
+
if block
|
179
|
+
if @subscription_client
|
180
|
+
raise SubscriptionError, "This client is already subscribed"
|
181
|
+
end
|
171
182
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
183
|
+
begin
|
184
|
+
@subscription_client = SubscribedClient.new(@client.pubsub)
|
185
|
+
if timeout > 0
|
186
|
+
@subscription_client.send(method, timeout, *channels, &block)
|
187
|
+
else
|
188
|
+
@subscription_client.send(method, *channels, &block)
|
189
|
+
end
|
190
|
+
ensure
|
191
|
+
@subscription_client = nil
|
178
192
|
end
|
179
|
-
|
180
|
-
@subscription_client
|
193
|
+
else
|
194
|
+
unless @subscription_client
|
195
|
+
raise SubscriptionError, "This client is not subscribed"
|
196
|
+
end
|
197
|
+
|
198
|
+
@subscription_client.call_v([method].concat(channels))
|
181
199
|
end
|
182
200
|
end
|
183
201
|
end
|
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: 5.0.
|
4
|
+
version: 5.0.1
|
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: 2022-08-
|
19
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: redis-client
|
@@ -75,9 +75,9 @@ licenses:
|
|
75
75
|
metadata:
|
76
76
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
77
77
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
|
78
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/5.0.
|
78
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/5.0.1
|
79
79
|
homepage_uri: https://github.com/redis/redis-rb
|
80
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/v5.0.
|
80
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v5.0.1
|
81
81
|
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|
@@ -89,9 +89,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: 2.5.0
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubygems_version: 3.1.2
|
97
97
|
signing_key:
|