🐛 reconnect after TimeoutError
All checks were successful
ci / docker (push) Successful in 6m12s
Python formatting PEP8 / Python-PEP8 (push) Successful in 15s

This commit is contained in:
Finn Christiansen 2024-11-20 20:58:29 +01:00
parent cb451f02af
commit 7b77fdaabe

View file

@ -9,6 +9,7 @@ import time
from aiohttp.client_exceptions import ServerDisconnectedError from aiohttp.client_exceptions import ServerDisconnectedError
from email.mime.text import MIMEText from email.mime.text import MIMEText
from dotenv import load_dotenv from dotenv import load_dotenv
from asyncio import TimeoutError
load_dotenv() load_dotenv()
@ -117,7 +118,7 @@ The link will be valid for 7 days.""".format(os.getenv("REGISTRATION_URL") + res
while True: while True:
try: try:
bot.run() bot.run()
except (ServerDisconnectedError, ValueError): except (ServerDisconnectedError, ValueError, TimeoutError):
logging.info("connection lost, reconnecting in 5 seconds...") logging.info("connection lost, reconnecting in 5 seconds...")
time.sleep(5) time.sleep(5)
except KeyboardInterrupt: except KeyboardInterrupt: