aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-07-07 19:58:15 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-07-07 19:58:15 +0300
commite6fed40da875a3866d8f2156d1a381faabab5ef7 (patch)
treec5276f625b5aa63d9d9714788ac6e0386d0ef647
parentFixes 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.py6
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."""