Show error and wait on database connection failure
This commit is contained in:
parent
6951c15167
commit
f4f312fd9a
@ -18,7 +18,8 @@ async def connect(username, password, database, host, port):
|
|||||||
try:
|
try:
|
||||||
return await asyncpg.create_pool(user=username, password=password, database=database, host=host, port=port)
|
return await asyncpg.create_pool(user=username, password=password, database=database, host=host, port=port)
|
||||||
except (ConnectionError, asyncpg.exceptions.CannotConnectNowError):
|
except (ConnectionError, asyncpg.exceptions.CannotConnectNowError):
|
||||||
pass
|
logger.exception("Failed to connect to database, retrying in 5 seconds...")
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
def db_wrap(func):
|
def db_wrap(func):
|
||||||
async def inner(*args, **kwargs):
|
async def inner(*args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user