diff options
author | 2021-07-07 19:58:15 +0300 | |
---|---|---|
committer | 2021-07-07 19:58:15 +0300 | |
commit | e6fed40da875a3866d8f2156d1a381faabab5ef7 (patch) | |
tree | c5276f625b5aa63d9d9714788ac6e0386d0ef647 | |
parent | Fixes N818 Compliance (diff) |
Prevents Blocking In Ping Command
Makes the network fetch asynchronous to prevent blocking the program.
Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r-- | bot/exts/utils/ping.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/utils/ping.py b/bot/exts/utils/ping.py index 58485fc34..c6d7bd900 100644 --- a/bot/exts/utils/ping.py +++ b/bot/exts/utils/ping.py @@ -39,9 +39,9 @@ class Latency(commands.Cog): bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms" try: - request = await self.bot.http_session.get(f"{URLs.site_api_schema}{URLs.site_api}/healthcheck") - request.raise_for_status() - site_status = "Healthy" + async with self.bot.http_session.get(f"{URLs.site_api_schema}{URLs.site_api}/healthcheck") as request: + request.raise_for_status() + site_status = "Healthy" except client_exceptions.ClientResponseError as e: """The site returned an unexpected response.""" |