diff options
Diffstat (limited to 'redis/asyncio/connection.py')
-rw-r--r-- | redis/asyncio/connection.py | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 4c75d2f..6823dcb 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -7,7 +7,6 @@ import io import os import socket import ssl -import sys import threading import weakref from itertools import chain @@ -864,12 +863,10 @@ class Connection: async def check_health(self): """Check the health of the connection with a PING/PONG""" - if sys.version_info[0:2] == (3, 6): - func = asyncio.get_event_loop - else: - func = asyncio.get_running_loop - - if self.health_check_interval and func().time() > self.next_health_check: + if ( + self.health_check_interval + and asyncio.get_running_loop().time() > self.next_health_check + ): await self.retry.call_with_retry(self._send_ping, self._ping_failed) async def _send_packed_command(self, command: Iterable[bytes]) -> None: @@ -957,11 +954,8 @@ class Connection: raise if self.health_check_interval: - if sys.version_info[0:2] == (3, 6): - func = asyncio.get_event_loop - else: - func = asyncio.get_running_loop - self.next_health_check = func().time() + 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 @@ -992,11 +986,8 @@ class Connection: raise if self.health_check_interval: - if sys.version_info[0:2] == (3, 6): - func = asyncio.get_event_loop - else: - func = asyncio.get_running_loop - self.next_health_check = func().time() + 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 |