From e7ef54a0aeb55accc14b72f4faef5fc2e4c9a780 Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:59:31 +0200 Subject: [PATCH] Fix bug: client side caching causes unexpected disconnections (async version) (#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 --- redis/_parsers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/_parsers/base.py b/redis/_parsers/base.py index 8e59249bef..0137539d66 100644 --- a/redis/_parsers/base.py +++ b/redis/_parsers/base.py @@ -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