Use sqlalchemy pool_recycle 3600 (seconds) to avoid re-using connections that MySQL already closed.
This fixes "MySQL server has gone away" error that occurs after long idle times. Change-Id: I9e17ac6d2494e0db5f3d3ccbd5e45dd3172e7141 Signed-off-by: Pino de Candia <giuseppe.decandia@gmail.com>
This commit is contained in:
parent
3dc247767d
commit
e72df954d7
@ -23,7 +23,7 @@ class SQLAlchemySessionManager(object):
|
||||
|
||||
def __init__(self):
|
||||
LOG.info('Creating sqlalchemy engine {}'.format(config.CONF.tatu.sqlalchemy_engine))
|
||||
self.engine = create_engine(config.CONF.tatu.sqlalchemy_engine)
|
||||
self.engine = create_engine(config.CONF.tatu.sqlalchemy_engine, pool_recycle=3600)
|
||||
#self.engine.execute("CREATE DATABASE IF NOT EXISTS tatu;")
|
||||
#self.engine.execute("USE tatu;")
|
||||
Base.metadata.create_all(self.engine)
|
||||
|
Loading…
Reference in New Issue
Block a user