tweak db connection settings
This commit is contained in:
parent
859fde7648
commit
03a0c423be
|
@ -50,7 +50,7 @@ else:
|
|||
#DBUSER=$USER
|
||||
#DBPASS=
|
||||
#DBTABLE=uncia
|
||||
#DBCONNUM=10
|
||||
#DBCONNUM=25
|
||||
|
||||
# Web forward config
|
||||
SECRET={ranchars}
|
||||
|
@ -60,10 +60,10 @@ SECRET={ranchars}
|
|||
newenvfile.write(newenv)
|
||||
|
||||
try:
|
||||
db_connection_count = int(env.get('DBCONNUM', 10))
|
||||
db_connection_count = int(env.get('DBCONNUM', 25))
|
||||
|
||||
except:
|
||||
db_connection_count = 10
|
||||
db_connection_count = 25
|
||||
|
||||
dbconfig = {
|
||||
'host': env.get('DBHOST'),
|
||||
|
|
|
@ -33,7 +33,8 @@ def dbconn(database, pooled=True):
|
|||
})
|
||||
|
||||
if pooled:
|
||||
return PooledPg(dbconfig['connum'], maxusage=None, **options)
|
||||
cached = 5 if dbconfig['connum'] >= 5 else 0
|
||||
return PooledPg(maxconnections=dbconfig['connum'], mincached=cached, maxusage=2, **options)
|
||||
|
||||
else:
|
||||
return pg.DB(**options)
|
||||
|
|
Loading…
Reference in a new issue