diff options
author | Kristján Valur Jónsson <sweskman@gmail.com> | 2022-09-28 13:21:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 16:21:19 +0300 |
commit | 6b3e0b491c4a348ca2e7a332e6f3b23a5da3c461 (patch) | |
tree | ae238a90ce3d724693c3ab4331f5ea1747871051 /redis/asyncio/connection.py | |
parent | 7c6a8128660d713f11d34ed4b5652ccbd9548e52 (diff) | |
download | redis-py-6b3e0b491c4a348ca2e7a332e6f3b23a5da3c461.tar.gz |
Dev/no lock (#2308)
* Remove async lock in asyncio.Connection.read_response
* Skip concurrent-commands test on non-pooled connections
Diffstat (limited to 'redis/asyncio/connection.py')
-rw-r--r-- | redis/asyncio/connection.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index db8c240..16f33e2 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -671,7 +671,6 @@ class Connection: self.set_parser(parser_class) self._connect_callbacks: List[weakref.WeakMethod[ConnectCallbackT]] = [] self._buffer_cutoff = 6000 - self._lock = asyncio.Lock() def __repr__(self): repr_args = ",".join((f"{k}={v}" for k, v in self.repr_pieces())) @@ -942,39 +941,6 @@ class Connection: async def read_response(self, disable_decoding: bool = False): """Read the response from a previously sent command""" try: - async with self._lock: - if self.socket_timeout: - async with async_timeout.timeout(self.socket_timeout): - response = await self._parser.read_response( - disable_decoding=disable_decoding - ) - else: - response = await self._parser.read_response( - disable_decoding=disable_decoding - ) - except asyncio.TimeoutError: - await self.disconnect() - raise TimeoutError(f"Timeout reading from {self.host}:{self.port}") - except OSError as e: - await self.disconnect() - raise ConnectionError( - f"Error while reading from {self.host}:{self.port} : {e.args}" - ) - except BaseException: - await self.disconnect() - raise - - if self.health_check_interval: - next_time = asyncio.get_running_loop().time() + self.health_check_interval - self.next_health_check = next_time - - if isinstance(response, ResponseError): - raise response from None - return response - - async def read_response_without_lock(self, disable_decoding: bool = False): - """Read the response from a previously sent command""" - try: if self.socket_timeout: async with async_timeout.timeout(self.socket_timeout): response = await self._parser.read_response( @@ -1241,7 +1207,6 @@ class UnixDomainSocketConnection(Connection): # lgtm [py/missing-call-to-init] self.set_parser(parser_class) self._connect_callbacks = [] self._buffer_cutoff = 6000 - self._lock = asyncio.Lock() def repr_pieces(self) -> Iterable[Tuple[str, Union[str, int]]]: pieces = [("path", self.path), ("db", self.db)] |