diff options
-rw-r--r-- | kombu/transport/redis.py | 2 | ||||
-rw-r--r-- | t/unit/transport/test_redis.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/kombu/transport/redis.py b/kombu/transport/redis.py index 32a5d4ec..861e612d 100644 --- a/kombu/transport/redis.py +++ b/kombu/transport/redis.py @@ -856,7 +856,7 @@ class Channel(virtual.Channel): except self.connection_errors: self._in_listen = None raise - if response is not None: + if isinstance(response, (list, tuple)): payload = self._handle_message(c, response) if bytes_to_str(payload['type']).endswith('message'): channel = bytes_to_str(payload['channel']) diff --git a/t/unit/transport/test_redis.py b/t/unit/transport/test_redis.py index 4222d244..cbf37db8 100644 --- a/t/unit/transport/test_redis.py +++ b/t/unit/transport/test_redis.py @@ -576,6 +576,12 @@ class test_Channel: assert self.channel._receive_one(self.channel.subclient) is None + def test_receive_invalid_response_type(self): + s = self.channel.subclient = Mock() + for resp in ['foo', None]: + s.parse_response.return_value = resp + assert self.channel._receive_one(self.channel.subclient) is None + def test_receive_connection_has_gone(self): def _receive_one(c): c.connection = None |