Ensure DB pooling code works with newer eventlet versions
Bug 1097992 Change-Id: Id14697a0a4815d0aacbae769bf538a96d6846567
This commit is contained in:
parent
5840f24ef3
commit
428290399a
|
@ -137,8 +137,16 @@ def configure_db():
|
||||||
'max_size': cfg.CONF.DATABASE.sql_max_pool_size,
|
'max_size': cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
'max_idle': cfg.CONF.DATABASE.sql_idle_timeout
|
'max_idle': cfg.CONF.DATABASE.sql_idle_timeout
|
||||||
}
|
}
|
||||||
creator = db_pool.ConnectionPool(MySQLdb, **pool_args)
|
pool = db_pool.ConnectionPool(MySQLdb, **pool_args)
|
||||||
engine_args['creator'] = creator.create
|
|
||||||
|
def creator():
|
||||||
|
conn = pool.create()
|
||||||
|
# NOTE(belliott) eventlet >= 0.10 returns a tuple
|
||||||
|
if isinstance(conn, tuple):
|
||||||
|
_1, _2, conn = conn
|
||||||
|
return conn
|
||||||
|
|
||||||
|
engine_args['creator'] = creator
|
||||||
if (MySQLdb is None and cfg.CONF.DATABASE.sql_dbpool_enable):
|
if (MySQLdb is None and cfg.CONF.DATABASE.sql_dbpool_enable):
|
||||||
LOG.warn(_("Eventlet connection pooling will not work without "
|
LOG.warn(_("Eventlet connection pooling will not work without "
|
||||||
"python-mysqldb!"))
|
"python-mysqldb!"))
|
||||||
|
|
Loading…
Reference in New Issue