Use pool_recycle when connecting to a mysql db

This commit is contained in:
Ryan Kelly 2015-01-09 08:46:15 +11:00
parent 5d44e8152f
commit d95c1e6a4f

View File

@ -118,6 +118,9 @@ class StaticNodeAssignment(object):
if urlparse.urlparse(sqluri).path.lower() in ("/", "/:memory:"): if urlparse.urlparse(sqluri).path.lower() in ("/", "/:memory:"):
sqlkw["pool_size"] = 1 sqlkw["pool_size"] = 1
sqlkw["max_overflow"] = 0 sqlkw["max_overflow"] = 0
if "mysql" in self.driver:
# Guard against the db closing idle conections.
sqlkw["pool_recycle"] = 3600
self._engine = create_engine(sqluri, **sqlkw) self._engine = create_engine(sqluri, **sqlkw)
users.create(self._engine, checkfirst=True) users.create(self._engine, checkfirst=True)