Skip to content

Commit

Permalink
Merge branch 'release_23.2' into release_24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Mar 6, 2024
2 parents d1e654c + 6728e48 commit 8b44fde
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/galaxy/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ def check_database_connection(session):
by rolling back the invalidated transaction.
Ref: https://docs.sqlalchemy.org/en/14/errors.html#can-t-reconnect-until-invalid-transaction-is-rolled-back
"""
if session and session.connection().invalidated:
log.error("Database transaction rolled back due to invalid state.")
assert session
if isinstance(session, scoped_session):
session = session()
trans = session.get_transaction()
if (trans and not trans.is_active) or session.connection().invalidated:
session.rollback()
log.error("Database transaction rolled back due to inactive session transaction or invalid connection state.")


# TODO: Refactor this to be a proper class, not a bunch.
Expand Down

0 comments on commit 8b44fde

Please sign in to comment.