Show error and wait on database connection failure

This commit is contained in:
Ske 2018-09-16 19:37:51 +02:00
parent 6951c15167
commit f4f312fd9a

View File

@ -18,7 +18,8 @@ async def connect(username, password, database, host, port):
try:
return await asyncpg.create_pool(user=username, password=password, database=database, host=host, port=port)
except (ConnectionError, asyncpg.exceptions.CannotConnectNowError):
pass
logger.exception("Failed to connect to database, retrying in 5 seconds...")
time.sleep(5)
def db_wrap(func):
async def inner(*args, **kwargs):