From e0059dd1e7281f30086a9c4583930d5a728b5cc2 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 21 Sep 2024 01:04:59 +0200 Subject: [PATCH] Don't crash the discussions task on timeouts and other mundane server errors --- src/discussions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/discussions.py b/src/discussions.py index b1dcd79..9259580 100644 --- a/src/discussions.py +++ b/src/discussions.py @@ -12,7 +12,7 @@ from src.api.util import default_message from src.discord.queue import QueueEntry, messagequeue from src.i18n import langs from src.misc import prepare_settings -from src.exceptions import WikiError +from src.exceptions import WikiError, WikiServerError from src.config import settings from src.queue_handler import dbmanager from src.argparser import command_line_args @@ -82,6 +82,9 @@ class Discussions: except asyncio.TimeoutError: logger.debug("Timeout on reading JSON of discussion post feed.") return + except WikiServerError: + logger.exception("Wiki server error.") + return if isinstance(discussion_feed, list) and any(discussion_feed) is False: return if wiki.discussion_id is None: # new wiki, just get the last post to not spam the channel @@ -110,6 +113,7 @@ class Discussions: except aiohttp.ClientResponseError: # Fandom can be funny sometimes... See #30 comment_pages = None except: + comment_pages = None if command_line_args.debug: logger.exception("Exception on Feeds article comment request") else: