Remove unnecessary flush from recorder (#71910)

This commit is contained in:
J. Nick Koston 2022-05-16 18:03:02 -05:00 committed by GitHub
parent f4a2afeb37
commit 8fcee01db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -847,15 +847,14 @@ class Recorder(threading.Thread):
assert self.event_session is not None
self._commits_without_expire += 1
self.event_session.commit()
if self._pending_expunge:
self.event_session.flush()
for dbstate in self._pending_expunge:
# Expunge the state so its not expired
# until we use it later for dbstate.old_state
if dbstate in self.event_session:
self.event_session.expunge(dbstate)
self._pending_expunge = []
self.event_session.commit()
# We just committed the state attributes to the database
# and we now know the attributes_ids. We can save