File tree Expand file tree Collapse file tree 4 files changed +1
-103
lines changed Expand file tree Collapse file tree 4 files changed +1
-103
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# Unreleased 5.0.0
4
4
5
+ - Removed the deprecated ` queue ` and ` commit ` methods. Use ` pipelined ` instead.
5
6
- Removed the deprecated ` pipelined ` and ` multi ` signature. Commands now MUST be called on the block argument, not the original redis instance.
6
7
- Removed ` Redis.current ` . You shouldn't assume there is a single global Redis connection, use a connection pool instead,
7
8
and libaries using Redis should accept a Redis instance (or connection pool) as a config. E.g. ` MyLibrary.redis = Redis.new(...) ` .
Original file line number Diff line number Diff line change @@ -90,47 +90,6 @@ def with
90
90
yield self
91
91
end
92
92
93
- # @deprecated Queues a command for pipelining.
94
- #
95
- # Commands in the queue are executed with the Redis#commit method.
96
- #
97
- # See http://redis.io/topics/pipelining for more details.
98
- #
99
- def queue ( *command )
100
- ::Redis . deprecate! (
101
- "Redis#queue is deprecated and will be removed in Redis 5.0.0. Use Redis#pipelined instead." \
102
- "(called from: #{ caller ( 1 , 1 ) . first } )"
103
- )
104
-
105
- synchronize do
106
- @queue [ Thread . current . object_id ] << command
107
- end
108
- end
109
-
110
- # @deprecated Sends all commands in the queue.
111
- #
112
- # See http://redis.io/topics/pipelining for more details.
113
- #
114
- def commit
115
- ::Redis . deprecate! (
116
- "Redis#commit is deprecated and will be removed in Redis 5.0.0. Use Redis#pipelined instead. " \
117
- "(called from: #{ Kernel . caller ( 1 , 1 ) . first } )"
118
- )
119
-
120
- synchronize do |client |
121
- begin
122
- pipeline = Pipeline . new ( client )
123
- @queue [ Thread . current . object_id ] . each do |command |
124
- pipeline . call ( command )
125
- end
126
-
127
- client . call_pipelined ( pipeline )
128
- ensure
129
- @queue . delete ( Thread . current . object_id )
130
- end
131
- end
132
- end
133
-
134
93
def _client
135
94
@client
136
95
end
Original file line number Diff line number Diff line change @@ -26,38 +26,6 @@ def test_call_raise
26
26
end
27
27
end
28
28
29
- def test_queue_commit
30
- r . queue ( "SET" , "foo" , "bar" )
31
- r . queue ( "GET" , "foo" )
32
- result = r . commit
33
-
34
- assert_equal result , [ "OK" , "bar" ]
35
- end
36
-
37
- def test_commit_raise
38
- r . queue ( "SET" , "foo" , "bar" )
39
- r . queue ( "INCR" )
40
-
41
- assert_raises ( Redis ::CommandError ) do
42
- r . commit
43
- end
44
- end
45
-
46
- def test_queue_after_error
47
- r . queue ( "SET" , "foo" , "bar" )
48
- r . queue ( "INCR" )
49
-
50
- assert_raises ( Redis ::CommandError ) do
51
- r . commit
52
- end
53
-
54
- r . queue ( "SET" , "foo" , "bar" )
55
- r . queue ( "INCR" , "baz" )
56
- result = r . commit
57
-
58
- assert_equal result , [ "OK" , 1 ]
59
- end
60
-
61
29
def test_client_with_custom_connector
62
30
custom_connector = Class . new ( Redis ::Client ::Connector ) do
63
31
def resolve
Original file line number Diff line number Diff line change @@ -27,35 +27,5 @@ def test_thread_safety
27
27
assert_equal [ "1" ] , @foos . uniq
28
28
assert_equal [ "2" ] , @bars . uniq
29
29
end
30
-
31
- def test_thread_safety_queue_commit
32
- redis = Redis . new ( OPTIONS )
33
- redis . set "foo" , 1
34
- redis . set "bar" , 2
35
-
36
- sample = 100
37
-
38
- t1 = Thread . new do
39
- sample . times do
40
- r . queue ( "get" , "foo" )
41
- end
42
-
43
- @foos = r . commit
44
- end
45
-
46
- t2 = Thread . new do
47
- sample . times do
48
- r . queue ( "get" , "bar" )
49
- end
50
-
51
- @bars = r . commit
52
- end
53
-
54
- t1 . join
55
- t2 . join
56
-
57
- assert_equal [ "1" ] , @foos . uniq
58
- assert_equal [ "2" ] , @bars . uniq
59
- end
60
30
end
61
31
end
You can’t perform that action at this time.
0 commit comments