move try except inside while loops in karen.py
@@ -237,26 +237,28 @@ class MechaKaren:
self.logger.error(format_exception(e))
async def heal_users_loop(self):
- try:
while True:
await asyncio.sleep(32)
+
+ try:
await self.db.execute("UPDATE users SET health = health + 1 WHERE health < 20")
except Exception as e:
self.logger.error(format_exception(e))
async def clear_trivia_commands_loop(self):
- try:
while True:
await asyncio.sleep(10 * 60)
+
+ try:
self.v.trivia_commands.clear()
except Exception as e:
self.logger.error(format_exception(e))
async def remind_reminders_loop(self):
- try:
while True:
await asyncio.sleep(5)
+ try:
reminders = await self.db.fetch("DELETE FROM reminders WHERE at <= NOW() RETURNING *")
for reminder in reminders:
