Skip to content

Commit 2650573

Browse files
committed
automatically connect for blocking reads (asyncio)
1 parent b2fa3a8 commit 2650573

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

redis/asyncio/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ async def can_read(self, timeout: float = 0):
930930

931931
async def read_response(self, disable_decoding: bool = False):
932932
"""Read the response from a previously sent command"""
933+
if not self.is_connected:
934+
await self.connect()
933935
try:
934936
async with self._lock:
935937
if self.socket_timeout:

tests/test_asyncio/test_pubsub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ def callback(message):
790790

791791

792792
# @pytest.mark.xfail
793-
@pytest.mark.parametrize("method", ["get_message", pytest.param("listen", marks=pytest.mark.xfail)])
793+
@pytest.mark.parametrize("method", ["get_message", "listen"])
794794
@pytest.mark.onlynoncluster
795795
class TestPubSubAutoReconnect:
796796
timeout = 2

0 commit comments

Comments
 (0)