summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
18308ef)
Signed-off-by: Torsten Werner <twerner@debian.org>
Name "projectb";
Host "";
Port 5433;
Name "projectb";
Host "";
Port 5433;
+ // PoolSize should be at least ThreadCount + 1
+ PoolSize 17;
+ // MaxOverflow shouldn't exceed postgresql.conf's max_connections - PoolSize
+ MaxOverflow 13;
connstr = "postgres:///%s" % cnf["DB::Name"]
if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
connstr += "?port=%s" % cnf["DB::Port"]
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,
self.db_meta = MetaData()
self.db_meta.bind = self.db_pg
self.db_smaker = sessionmaker(bind=self.db_pg,