aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2021-03-27 11:59:22 +0100
committerGravatar kwzrd <[email protected]>2021-03-27 12:11:20 +0100
commit288cdac3e826a4fb67d8ba2c1fe98ea52f9fe658 (patch)
tree30a6e1289264666e780224f920801b6de6c636e3
parentBranding: make 'meta.md' parser synchronous (diff)
Branding: ensure daemon logs exceptions
-rw-r--r--bot/exts/backend/branding/_cog.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/bot/exts/backend/branding/_cog.py b/bot/exts/backend/branding/_cog.py
index d6c5b159b..57347b60e 100644
--- a/bot/exts/backend/branding/_cog.py
+++ b/bot/exts/backend/branding/_cog.py
@@ -477,19 +477,22 @@ class Branding(commands.Cog):
"""
log.trace("Daemon loop: calling daemon main")
- await self.daemon_main()
+ try:
+ await self.daemon_main()
+ except Exception:
+ log.exception("Daemon loop: failed with an unhandled exception!")
@daemon_loop.before_loop
async def daemon_before(self) -> None:
"""
- Call `daemon_main` immediately, then block `daemon_loop` until the next-up UTC midnight.
+ Call `daemon_loop` immediately, then block the loop until the next-up UTC midnight.
- The first iteration will be invoked manually such that synchronisation happens immediately after daemon start.
+ The first iteration is invoked directly such that synchronisation happens immediately after daemon start.
We then calculate the time until the next-up midnight and sleep before letting `daemon_loop` begin.
"""
- log.info("Daemon before: synchronising guild")
+ log.trace("Daemon before: performing start-up iteration")
- await self.daemon_main()
+ await self.daemon_loop()
log.trace("Daemon before: calculating time to sleep before loop begins")
now = datetime.utcnow()