Prevent sqlalchemy from refetching the old_state_id as it will never change (#40982)
Disable expire_on_commit for the event writer. Since we never expect the old_state_id to change in the database, it was never worth the expense of refetching the id after the commit.
This commit is contained in:
parent
cf785b86db
commit
6b509fd9db
1 changed files with 3 additions and 1 deletions
|
@ -573,7 +573,9 @@ class Recorder(threading.Thread):
|
||||||
sqlalchemy_event.listen(self.engine, "connect", setup_recorder_connection)
|
sqlalchemy_event.listen(self.engine, "connect", setup_recorder_connection)
|
||||||
|
|
||||||
Base.metadata.create_all(self.engine)
|
Base.metadata.create_all(self.engine)
|
||||||
self.get_session = scoped_session(sessionmaker(bind=self.engine))
|
self.get_session = scoped_session(
|
||||||
|
sessionmaker(bind=self.engine, expire_on_commit=False)
|
||||||
|
)
|
||||||
|
|
||||||
def _close_connection(self):
|
def _close_connection(self):
|
||||||
"""Close the connection."""
|
"""Close the connection."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue