Reduce orm overhead by grouping object expiration (#41394)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-10-07 15:35:48 +02:00
1 parent 0dabf4962e
commit 113d738fa2
2 files changed
+31 -13

No files matched your search

+4 -4
View File
@@ -1,12 +1,12 @@
"""Common test utils for working with recorder."""
from datetime import timedelta
from homeassistant.components import recorder
from homeassistant.util import dt as dt_util
from tests.common import fire_time_changed
DB_COMMIT_INTERVAL = 50
def wait_recording_done(hass):
"""Block till recording is done."""
@@ -18,6 +18,6 @@ def wait_recording_done(hass):
def trigger_db_commit(hass):
"""Force the recorder to commit."""
for _ in range(DB_COMMIT_INTERVAL):
for _ in range(recorder.DEFAULT_COMMIT_INTERVAL):
# We only commit on time change
fire_time_changed(hass, dt_util.utcnow())
fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=1))