Skip to content

Commit

Permalink
Use disable_decoding in async read_response. (#3042)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDenkoV committed Dec 3, 2023
1 parent a60d25e commit ac92e0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Fix async `read_response` to use `disable_decoding`.
* Add 'aclose()' methods to async classes, deprecate async close().
* Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url()
* Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error`
Expand Down
10 changes: 8 additions & 2 deletions redis/_parsers/hiredis.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,16 @@ async def read_response(
if not self._connected:
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None

response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()
while response is False:
await self.read_from_socket()
response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()

# if the response is a ConnectionError or the response is a list and
# the first item is a ConnectionError, raise it as something bad
Expand Down

0 comments on commit ac92e0c

Please sign in to comment.