From 7b77fdaabe41ecd38e008e463f4b5cb8c7bc8078 Mon Sep 17 00:00:00 2001 From: Finn Christiansen Date: Wed, 20 Nov 2024 20:58:29 +0100 Subject: [PATCH] :bug: reconnect after TimeoutError --- matrix_bot_invitation_mailer/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix_bot_invitation_mailer/__main__.py b/matrix_bot_invitation_mailer/__main__.py index fbcf45d..586b67d 100644 --- a/matrix_bot_invitation_mailer/__main__.py +++ b/matrix_bot_invitation_mailer/__main__.py @@ -9,6 +9,7 @@ import time from aiohttp.client_exceptions import ServerDisconnectedError from email.mime.text import MIMEText from dotenv import load_dotenv +from asyncio import TimeoutError load_dotenv() @@ -117,7 +118,7 @@ The link will be valid for 7 days.""".format(os.getenv("REGISTRATION_URL") + res while True: try: bot.run() - except (ServerDisconnectedError, ValueError): + except (ServerDisconnectedError, ValueError, TimeoutError): logging.info("connection lost, reconnecting in 5 seconds...") time.sleep(5) except KeyboardInterrupt: