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)
277
277
278
278
def with_socket_timeout ( timeout )
279
279
connect unless connected?
280
+ original = @options [ :read_timeout ]
280
281
281
282
begin
282
283
connection . timeout = timeout
284
+ @options [ :read_timeout ] = timeout # for reconnection
283
285
yield
284
286
ensure
285
287
connection . timeout = self . timeout if connected?
288
+ @options [ :read_timeout ] = original
286
289
end
287
290
end
288
291
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ def test_subscribe_with_timeout
254
254
received = false
255
255
256
256
assert_raise Redis ::TimeoutError do
257
- r . subscribe_with_timeout ( 1 , "foo" ) do |on |
257
+ r . subscribe_with_timeout ( LOW_TIMEOUT , "foo" ) do |on |
258
258
on . message do |channel , message |
259
259
received = true
260
260
end
@@ -268,7 +268,7 @@ def test_psubscribe_with_timeout
268
268
received = false
269
269
270
270
assert_raise Redis ::TimeoutError do
271
- r . psubscribe_with_timeout ( 1 , "f*" ) do |on |
271
+ r . psubscribe_with_timeout ( LOW_TIMEOUT , "f*" ) do |on |
272
272
on . message do |channel , message |
273
273
received = true
274
274
end
You can’t perform that action at this time.
0 commit comments