Skip to content

Commit e45207f

Browse files
committed
Fixing last linter errors. Fixes needed for pubsub message handling with hiredis.
1 parent 176baa8 commit e45207f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

redis/_parsers/hiredis.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ def __init__(self, socket_read_size: int):
196196
self._reader = None
197197
self.pubsub_push_handler_func = self.handle_pubsub_push_response
198198
self.invalidation_push_handler_func = None
199+
self._hiredis_PushNotificationType = None
200+
201+
async def handle_pubsub_push_response(self, response):
202+
logger = getLogger("push_response")
203+
logger.debug("Push response: " + str(response))
204+
return response
199205

200206
def on_connect(self, connection):
201207
import hiredis
@@ -215,7 +221,7 @@ def on_connect(self, connection):
215221

216222
try:
217223
self._hiredis_PushNotificationType = getattr(
218-
hiredis, "PushNotificationType", None
224+
hiredis, "PushNotification", None
219225
)
220226
except AttributeError:
221227
# hiredis < 3.2
@@ -257,6 +263,7 @@ async def read_response(
257263
response = self._reader.gets(False)
258264
else:
259265
response = self._reader.gets()
266+
260267
while response is NOT_ENOUGH_DATA:
261268
await self.read_from_socket()
262269
if disable_decoding:

redis/asyncio/connection.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,7 @@ async def read_response(
576576
read_timeout = timeout if timeout is not None else self.socket_timeout
577577
host_error = self._host_error()
578578
try:
579-
if (
580-
read_timeout is not None
581-
and self.protocol in ["3", 3]
582-
and not HIREDIS_AVAILABLE
583-
):
579+
if read_timeout is not None and self.protocol in ["3", 3]:
584580
async with async_timeout(read_timeout):
585581
response = await self._parser.read_response(
586582
disable_decoding=disable_decoding, push_request=push_request

tests/test_asyncio/test_pubsub.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import redis.asyncio as redis
1818
from redis.exceptions import ConnectionError
1919
from redis.typing import EncodableT
20-
from redis.utils import HIREDIS_AVAILABLE
2120
from tests.conftest import get_protocol_version, skip_if_server_version_lt
2221

2322
from .compat import aclosing, create_task, mock

0 commit comments

Comments
 (0)