Set pool_recycle for beaker sessions

Occasionally a beaker database connection will be disconnected
due to a long period of database inactivity. This can cause
users to be logged out before a session expires and can also
cause internal server errors when users try to log in. This patch
adds a sqlalchemy pool_recycle value of 10 minutes, so that beaker
doesn't potentially try to use a connection that has been disconnected
by the mysql server.

Change-Id: Ida99efbba1e99e72c1610cd2335560706f1523d7
Closes-Bug: #1514290
This commit is contained in:
Paul Van Eck 2015-11-08 19:52:02 -08:00
parent 2e5d56ad1f
commit 98dbf7e456
2 changed files with 3 additions and 1 deletions

View File

@ -217,6 +217,7 @@ def setup_app(config):
'session.url': CONF.database.connection,
'session.timeout': 604800,
'session.validate_key': api_utils.get_token(),
'session.sa.pool_recycle': 600
}
app = SessionMiddleware(app, beaker_conf)

View File

@ -228,5 +228,6 @@ class SetupAppTestCase(base.BaseTestCase):
'session.type': 'ext:database',
'session.url': 'fake_connection',
'session.timeout': 604800,
'session.validate_key': get_token.return_value}
'session.validate_key': get_token.return_value,
'session.sa.pool_recycle': 600}
)