(Core data): Restart when DB is inaccessible.

This commit is contained in:
2021-09-21 16:06:30 +03:00
parent ce3af79d3c
commit 73cceb0412
2 changed files with 38 additions and 0 deletions

View File

@@ -38,3 +38,10 @@ with conn:
log("Established connection.", "DB_INIT")
def reset_connection():
log("Re-establishing connection.", "DB_INIT", level=logging.DEBUG)
global conn
conn = psy.connect(conf.bot['database'], cursor_factory=DictLoggingCursor)
log("Re-established connection.", "DB_INIT")