🐛 reconnect after TimeoutError
This commit is contained in:
parent
cb451f02af
commit
7b77fdaabe
1 changed files with 2 additions and 1 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue