handle exceptions in the commands dump loop properly
@@ -135,6 +135,7 @@ class MechaKaren:
self.commands[packet.user_id] += 1
async def commands_dump_loop(self):
+ try:
while True:
await asyncio.sleep(60)
@@ -149,6 +150,8 @@ class MechaKaren:
"INSERT INTO leaderboards (user_id, commands) VALUES ($1, $2) ON CONFLICT DO UPDATE leaderboards SET commands = commands + $2 WHERE user_id = $1",
commands_dump,
)
+ except Exception as e:
+ self.logger.error(format_exception(e))
async def start(self, pp):
self.db = await asyncpg.connect(
