From d95c1e6a4f8a3fb608701cf7bc45dd31884ec12f Mon Sep 17 00:00:00 2001 From: Ryan Kelly Date: Fri, 9 Jan 2015 08:46:15 +1100 Subject: [PATCH] Use pool_recycle when connecting to a mysql db --- syncserver/staticnode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syncserver/staticnode.py b/syncserver/staticnode.py index d758aad..560d3ac 100644 --- a/syncserver/staticnode.py +++ b/syncserver/staticnode.py @@ -118,6 +118,9 @@ class StaticNodeAssignment(object): if urlparse.urlparse(sqluri).path.lower() in ("/", "/:memory:"): sqlkw["pool_size"] = 1 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) users.create(self._engine, checkfirst=True)