From d489b6428a930aedf59f723c503cf1c1312f7886 Mon Sep 17 00:00:00 2001 From: PredaaA <46051820+PredaaA@users.noreply.github.com> Date: Wed, 21 Apr 2021 02:43:55 +0200 Subject: [PATCH] [RndStatus] Re-order sleep in maybe_update_presence task (#226) --- rndstatus/rndstatus.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rndstatus/rndstatus.py b/rndstatus/rndstatus.py index 7fafa46..db61530 100644 --- a/rndstatus/rndstatus.py +++ b/rndstatus/rndstatus.py @@ -140,11 +140,10 @@ class RndStatus(commands.Cog): while True: try: await self.presence_updater() - await asyncio.sleep(int(delay)) - except asyncio.CancelledError: - break - except Exception as e: - log.exception(e, exc_info=e) + except Exception: + log.exception("Something went wrong in maybe_update_presence task:") + + await asyncio.sleep(int(delay)) async def presence_updater(self): pattern = re.compile(rf"<@!?{self.bot.user.id}>")