diff --git a/arxiv/base/__init__.py b/arxiv/base/__init__.py index 38f2f04f..6d068afe 100644 --- a/arxiv/base/__init__.py +++ b/arxiv/base/__init__.py @@ -125,6 +125,10 @@ def register_blueprint(self: Flask, blueprint: Blueprint, @app.teardown_appcontext def remove_scoped_session (response_or_exc: BaseException | None) -> None: - if response_or_exc: - Session.rollback() + """Cleans up the DB session. + + Will rollback any uncomitted transactions (via Session.remove() + which will call Sesion.close()). When Session is used again in this thread, + a new one will be created. + """ Session.remove()