Remove commented out block, edit comment

This commit is contained in:
John Davis
2025-01-09 11:54:20 -05:00
parent 2ba17ffecc
commit 0acf625f90
+2 -6
View File
@@ -44,6 +44,7 @@ REQUEST_ID: ContextVar[Union[Dict[str, str], None]] = ContextVar("request_id", d
@contextlib.contextmanager
def transaction(session: Union[scoped_session, Session, "SessionlessContext"]):
"""Start a new transaction only if one is not present."""
# TODO The `session.begin` code has been removed. Once we can verify this does not break SQLAlchemy transactions, remove this helper + all references (561)
# temporary hack; need to fix access to scoped_session callable, not proxy
if isinstance(session, scoped_session):
session = session()
@@ -52,12 +53,7 @@ def transaction(session: Union[scoped_session, Session, "SessionlessContext"]):
yield
return # exit: can't use as a Session
yield # TODO once we can verify this does not break SQLAlchemy transactions, remove this helper completely (561 instances)
# if not session.in_transaction(): # type:ignore[union-attr]
# with session.begin(): # type:ignore[union-attr]
# yield
# else:
# yield
yield
def check_database_connection(session):