File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -277,12 +277,15 @@ def write(command)
277277
278278 def with_socket_timeout ( timeout )
279279 connect unless connected?
280+ original = @options [ :read_timeout ]
280281
281282 begin
282283 connection . timeout = timeout
284+ @options [ :read_timeout ] = timeout # for reconnection
283285 yield
284286 ensure
285287 connection . timeout = self . timeout if connected?
288+ @options [ :read_timeout ] = original
286289 end
287290 end
288291
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ def test_subscribe_with_timeout
254254 received = false
255255
256256 assert_raise Redis ::TimeoutError do
257- r . subscribe_with_timeout ( 1 , "foo" ) do |on |
257+ r . subscribe_with_timeout ( LOW_TIMEOUT , "foo" ) do |on |
258258 on . message do |channel , message |
259259 received = true
260260 end
@@ -268,7 +268,7 @@ def test_psubscribe_with_timeout
268268 received = false
269269
270270 assert_raise Redis ::TimeoutError do
271- r . psubscribe_with_timeout ( 1 , "f*" ) do |on |
271+ r . psubscribe_with_timeout ( LOW_TIMEOUT , "f*" ) do |on |
272272 on . message do |channel , message |
273273 received = true
274274 end
You can’t perform that action at this time.
0 commit comments