Automatically reopen database connection on failure.

This commit is contained in:
Michael Herzberg 2017-09-15 18:23:25 +01:00
parent ddbbc2672d
commit 85680d360b
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class MysqlBackend:
if db is not None:
db.close()
db = None
db = MySQLdb.connect(**self.dbargs)
db.autocommit = True
self.cursor = db.cursor()
except Exception as e2:
log_error("Surpressed exception: {}".format(str(e2)), 3, self.ext_id)
raise last_exception