1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Prefilter more logbook events in sql (#36958)

* Prefilter more logbook events in sql

Prefilter sensor events in _keep_event before humanify

Cache static attribute lookup

Reduces logbook execution time by ~35%

* fix mocking in benchmark

* Update tests for logbook users
This commit is contained in:
J. Nick Koston
2020-06-21 12:50:58 -05:00
committed by GitHub
parent 29f128eaad
commit 59e43ab6e4
7 changed files with 275 additions and 108 deletions

View File

@@ -1040,6 +1040,7 @@ async def test_extraction_functions(hass):
async def test_logbook_humanify_automation_triggered_event(hass):
"""Test humanifying Automation Trigger event."""
await async_setup_component(hass, automation.DOMAIN, {})
entity_attr_cache = logbook.EntityAttributeCache(hass)
event1, event2 = list(
logbook.humanify(
@@ -1054,6 +1055,7 @@ async def test_logbook_humanify_automation_triggered_event(hass):
{ATTR_ENTITY_ID: "automation.bye", ATTR_NAME: "Bye Automation"},
),
],
entity_attr_cache,
)
)