]> git.donarmstrong.com Git - dak.git/blobdiff - daklib/dbconn.py
Make SQLAlchemy's pool parameters configurable.
[dak.git] / daklib / dbconn.py
index 04823061814912e5da33d084acaeb5cc1ecdf45f..1bf44c858650951be219bfdeb1a5b8c360709dec 100755 (executable)
@@ -3306,8 +3306,14 @@ class DBConn(object):
             connstr = "postgres:///%s" % cnf["DB::Name"]
             if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
                 connstr += "?port=%s" % cnf["DB::Port"]
-
-        self.db_pg   = create_engine(connstr, echo=self.debug)
+        if not cnf.has_key('DB::PoolSize'):
+            cnf['DB::PoolSize'] = '5'
+        if not cnf.has_key('DB::MaxOverflow'):
+            cnf['DB::MaxOverflow'] = '10'
+
+        self.db_pg   = create_engine(connstr, echo=self.debug,
+            pool_size=int(cnf['DB::PoolSize']),
+            max_overflow=int(cnf['DB::MaxOverflow']))
         self.db_meta = MetaData()
         self.db_meta.bind = self.db_pg
         self.db_smaker = sessionmaker(bind=self.db_pg,