Skip to content

Avoid running listen() if the node is disconnected #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,6 @@ class Redis(StrictRedis):
changed arguments to some commands to be more Pythonic, sane, or by
accident.
"""

# Overridden callbacks
RESPONSE_CALLBACKS = dict_merge(
StrictRedis.RESPONSE_CALLBACKS,
Expand Down Expand Up @@ -1482,6 +1481,9 @@ def unsubscribe(self, channels=[]):
def listen(self):
"Listen for messages on channels this client has been subscribed to"
while self.subscription_count or self.channels or self.patterns:
if self.connection == None:
break

r = self.parse_response()
msg_type = nativestr(r[0])
if msg_type == 'pmessage':
Expand Down