mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use faster time compare in history and live logbook (#113897)
This commit is contained in:
parent
e9c1753f3a
commit
1e54595084
@ -331,11 +331,14 @@ async def _async_events_consumer(
|
||||
no_attributes: bool,
|
||||
) -> None:
|
||||
"""Stream events from the queue."""
|
||||
subscriptions_setup_complete_timestamp = (
|
||||
subscriptions_setup_complete_time.timestamp()
|
||||
)
|
||||
while True:
|
||||
events: list[Event] = [await stream_queue.get()]
|
||||
# If the event is older than the last db
|
||||
# event we already sent it so we skip it.
|
||||
if events[0].time_fired <= subscriptions_setup_complete_time:
|
||||
if events[0].time_fired_timestamp <= subscriptions_setup_complete_timestamp:
|
||||
continue
|
||||
# We sleep for the EVENT_COALESCE_TIME so
|
||||
# we can group events together to minimize
|
||||
|
@ -222,11 +222,14 @@ async def _async_events_consumer(
|
||||
event_processor: EventProcessor,
|
||||
) -> None:
|
||||
"""Stream events from the queue."""
|
||||
subscriptions_setup_complete_timestamp = (
|
||||
subscriptions_setup_complete_time.timestamp()
|
||||
)
|
||||
while True:
|
||||
events: list[Event] = [await stream_queue.get()]
|
||||
# If the event is older than the last db
|
||||
# event we already sent it so we skip it.
|
||||
if events[0].time_fired <= subscriptions_setup_complete_time:
|
||||
if events[0].time_fired_timestamp <= subscriptions_setup_complete_timestamp:
|
||||
continue
|
||||
# We sleep for the EVENT_COALESCE_TIME so
|
||||
# we can group events together to minimize
|
||||
|
Loading…
x
Reference in New Issue
Block a user