mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Remove unnecessary flush from recorder (#71910)
This commit is contained in:
parent
f4a2afeb37
commit
8fcee01db0
@ -847,15 +847,14 @@ class Recorder(threading.Thread):
|
|||||||
assert self.event_session is not None
|
assert self.event_session is not None
|
||||||
self._commits_without_expire += 1
|
self._commits_without_expire += 1
|
||||||
|
|
||||||
|
self.event_session.commit()
|
||||||
if self._pending_expunge:
|
if self._pending_expunge:
|
||||||
self.event_session.flush()
|
|
||||||
for dbstate in self._pending_expunge:
|
for dbstate in self._pending_expunge:
|
||||||
# Expunge the state so its not expired
|
# Expunge the state so its not expired
|
||||||
# until we use it later for dbstate.old_state
|
# until we use it later for dbstate.old_state
|
||||||
if dbstate in self.event_session:
|
if dbstate in self.event_session:
|
||||||
self.event_session.expunge(dbstate)
|
self.event_session.expunge(dbstate)
|
||||||
self._pending_expunge = []
|
self._pending_expunge = []
|
||||||
self.event_session.commit()
|
|
||||||
|
|
||||||
# We just committed the state attributes to the database
|
# We just committed the state attributes to the database
|
||||||
# and we now know the attributes_ids. We can save
|
# and we now know the attributes_ids. We can save
|
||||||
|
Loading…
x
Reference in New Issue
Block a user