Merge "fix connection context manager in rc cache"

This commit is contained in:
Jenkins 2016-11-04 11:22:37 +00:00 committed by Gerrit Code Review
commit f223f2ebdb

View File

@ -44,7 +44,7 @@ def _refresh_from_db(ctx, cache):
:param cache: ResourceClassCache object to refresh.
"""
with ctx.session.connection() as conn:
with db_api.api_context_manager.reader.connection.using(ctx) as conn:
sel = sa.select([_RC_TBL.c.id, _RC_TBL.c.name])
res = conn.execute(sel).fetchall()
cache.id_cache = {r[1]: r[0] for r in res}