Skip to content

Commit

Permalink
Merge pull request #101 from thomasmckay/2204-cherry-pick
Browse files Browse the repository at this point in the history
QUAY-2204 - cherry-pick - avoid db connection timeouts
  • Loading branch information
thomasmckay committed Dec 16, 2019
2 parents e764907 + d387d38 commit cfd6f0d
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,15 @@ class OAuthApplication(BaseModel):
def upgrade(tables, tester, progress_reporter):
op = ProgressWrapper(original_op, progress_reporter)

# NOTE: Disconnects the Alembic database connection. We do this because the Peewee calls below
# use a *different* connection, and if we leave the alembic connection open, it'll time out.
# See: https://github.com/sqlalchemy/alembic/issues/630
op.get_bind().execute("COMMIT")
op.get_bind().invalidate()

from app import app

if app.config.get("SETUP_COMPLETE", False) or tester.is_testing():
# Empty all access token names to fix the bug where we put the wrong name and code
# in for some tokens.
(
AccessToken.update(token_name=None)
.where(~(AccessToken.token_name >> None), AccessToken.temporary == False)
.execute()
)

# AccessToken.
logger.info("Backfilling encrypted credentials for access tokens")
for access_token in _iterate(
Expand Down

0 comments on commit cfd6f0d

Please sign in to comment.