Skip to content

Commit 42c6703

Browse files
committed
fix automatic connect on blocking pubsub read (non-async)
1 parent 2650573 commit 42c6703

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

redis/connection.py

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

816816
def read_response(self, disable_decoding=False):
817817
"""Read the response from a previously sent command"""
818+
if not self._sock:
819+
self.connect()
818820
try:
819821
hosterr = f"{self.host}:{self.port}"
820822
except AttributeError:

tests/test_pubsub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def test_pubsub_deadlock(self, master_host):
613613

614614

615615
@pytest.mark.timeout(5, method="thread")
616-
@pytest.mark.parametrize("method", ["get_message", pytest.param("listen", marks=pytest.mark.xfail)])
616+
@pytest.mark.parametrize("method", ["get_message", "listen"])
617617
@pytest.mark.onlynoncluster
618618
class TestPubSubAutoReconnect:
619619
def mysetup(self, r, method):

0 commit comments

Comments
 (0)