Skip to content

Commit

Permalink
Fix bug: client side caching causes unexpected disconnections (async …
Browse files Browse the repository at this point in the history
…version) (redis#3165)

* fix disconnects

* skip test in cluster

* add test

* save return value from handle_push_response (without it 'read_response' return the push message)

* insert return response from cache to the try block to prevent connection leak

* enable to get connection with data avaliable to read in csc mode and change can_read_destructive to not read data

* fix check if socket is empty (at_eof() can return False but this doesn't mean there's definitely more data to read)

---------

Co-authored-by: Chayim <[email protected]>
  • Loading branch information
2 people authored and gerzse committed Jul 11, 2024
1 parent 8bb06c1 commit ae91fbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion redis/_parsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async def can_read_destructive(self) -> bool:
return True
try:
async with async_timeout(0):
return await self._stream.read(1)
return self._stream.at_eof()
except TimeoutError:
return False

Expand Down

0 comments on commit ae91fbe

Please sign in to comment.