summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
Diffstat (limited to 'redis')
-rw-r--r--redis/asyncio/client.py4
-rw-r--r--redis/asyncio/connection.py2
-rw-r--r--redis/asyncio/lock.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py
index 5a2c496..8fd9cd2 100644
--- a/redis/asyncio/client.py
+++ b/redis/asyncio/client.py
@@ -453,7 +453,7 @@ class Redis(
f"Unclosed client session {self!r}", ResourceWarning, source=self
)
context = {"client": self, "message": self._DEL_MESSAGE}
- asyncio.get_event_loop().call_exception_handler(context)
+ asyncio.get_running_loop().call_exception_handler(context)
async def close(self, close_connection_pool: Optional[bool] = None) -> None:
"""
@@ -798,7 +798,7 @@ class PubSub:
if (
conn.health_check_interval
- and asyncio.get_event_loop().time() > conn.next_health_check
+ and asyncio.get_running_loop().time() > conn.next_health_check
):
await conn.send_command(
"PING", self.HEALTH_CHECK_MESSAGE, check_health=False
diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py
index 4f19153..d031f41 100644
--- a/redis/asyncio/connection.py
+++ b/redis/asyncio/connection.py
@@ -532,7 +532,7 @@ class Connection:
def __del__(self):
try:
if self.is_connected:
- loop = asyncio.get_event_loop()
+ loop = asyncio.get_running_loop()
coro = self.disconnect()
if loop.is_running():
loop.create_task(coro)
diff --git a/redis/asyncio/lock.py b/redis/asyncio/lock.py
index 2f78d69..e1d11a8 100644
--- a/redis/asyncio/lock.py
+++ b/redis/asyncio/lock.py
@@ -201,14 +201,14 @@ class Lock:
blocking_timeout = self.blocking_timeout
stop_trying_at = None
if blocking_timeout is not None:
- stop_trying_at = asyncio.get_event_loop().time() + blocking_timeout
+ stop_trying_at = asyncio.get_running_loop().time() + blocking_timeout
while True:
if await self.do_acquire(token):
self.local.token = token
return True
if not blocking:
return False
- next_try_at = asyncio.get_event_loop().time() + sleep
+ next_try_at = asyncio.get_running_loop().time() + sleep
if stop_trying_at is not None and next_try_at > stop_trying_at:
return False
await asyncio.sleep(sleep)