diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-07-27 16:18:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 16:18:41 +0300 |
commit | 607a59ad6ff0cabc7b0af7480f42043aebc2a33b (patch) | |
tree | 9aed66dc63dabb925c08203c2dc82b057305e85a /redis/asyncio/connection.py | |
parent | f665bd306dc843cec3e8fa01d6f4061385d1812e (diff) | |
download | redis-py-607a59ad6ff0cabc7b0af7480f42043aebc2a33b.tar.gz |
Drop python 3.6 support (#2306)
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 |