Skip to content

disable_decoding not used in async version of read_response. #3035

Closed
@MrDenkoV

Description

@MrDenkoV

Version: redis-py version - 5.0.0 (I still see it on main)

Description:
Is there a reason why disable_decoding is not being used in async version of read_response?
It seems like there's no async way to get raw data (NEVER_DECODE) from Redis.
Are there any plans of adding the NEVER_DECODE support for async read_response?
We want to save pickled data (not compatible with UTF-8) in Redis, and for now we will use the workaround (as in #1006 (comment) ), but it's not a very clean solution.

redis/_parsers/hiredis.py:204

async def read_response(
self, disable_decoding: bool = False
) -> Union[EncodableT, List[EncodableT]]:
# If `on_disconnect()` has been called, prohibit any more reads
# even if they could happen because data might be present.
# We still allow reads in progress to finish
if not self._connected:
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None
response = self._reader.gets()
while response is False:
await self.read_from_socket()
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
# happened
if isinstance(response, ConnectionError):
raise response
elif (
isinstance(response, list)
and response
and isinstance(response[0], ConnectionError)
):
raise response[0]
return response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions