Don't crash the discussions task on timeouts and other mundane server errors

This commit is contained in:
Frisk 2024-09-21 01:04:59 +02:00
parent 482b217c1f
commit e0059dd1e7

View file

@ -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: