[FIX] the database connectin pool generate at least one connection to ensure earliest that the database is reachable

bzr revid: christophe@cobalt-20081215153616-dyb7xj771tzj5de1
This commit is contained in:
Christophe Simonis 2008-12-15 16:36:16 +01:00
parent 85c8b304bf
commit be2a0a76bb
1 changed files with 2 additions and 2 deletions

View File

@ -213,9 +213,9 @@ class PoolManager(object):
logger = netsvc.Logger()
try:
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,))
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(0, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(1, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
except Exception, e:
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %r' % (db_name, e))
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %s' % (db_name, e.message))
raise
return PoolManager._pools[db_name]
get = staticmethod(get)