Change to flask sqlalchemy db session close #309
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removes unnecessary rollback on error. The existing call to Session.remove() would already do this if there was an open transaction.
This call was the source of some errors in arxiv-browse. Errors during the
.remove()
call will could still happen but this change will avoid rollbacks when there are no changes and inREAD_UNCOMMITTED
. arxiv-browse runs inREAD_UNCOMMITTED
and makes no INSERT or UPDATEs.The Sqlalchemy docs say (sqlalchemy.scoping.scoped_session.close())
"This expunges all ORM objects associated with this
_orm.Session
, ends any transaction in progress andreleases
any_engine.Connection
objects which this_orm.Session
itself has checked out from associated_engine.Engine
objects. The operation then leaves the_orm.Session
in a state which it may be used again."See: https://github.com/sqlalchemy/sqlalchemy/blob/5b117f3d4b38d12d61a39fc60582d4348232334f/lib/sqlalchemy/orm/scoping.py#L483
arxivce-1639