Skip to content

Commit 8e28162

Browse files
committed
automatically connect for blocking reads (asyncio)
1 parent ceed54d commit 8e28162

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
@@ -933,6 +933,8 @@ async def can_read(self, timeout: float = 0):
933933

934934
async def read_response(self, disable_decoding: bool = False):
935935
"""Read the response from a previously sent command"""
936+
if not self.is_connected:
937+
await self.connect()
936938
try:
937939
async with self._lock:
938940
if self.socket_timeout:

tests/test_asyncio/test_pubsub.py

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

776776

777777
# @pytest.mark.xfail
778-
@pytest.mark.parametrize("method", ["get_message", pytest.param("listen", marks=pytest.mark.xfail)])
778+
@pytest.mark.parametrize("method", ["get_message", "listen"])
779779
@pytest.mark.onlynoncluster
780780
class TestPubSubAutoReconnect:
781781
timeout = 2

0 commit comments

Comments
 (0)