Fix duplicate events in live logbook (#113828)

This commit is contained in:
J. Nick Koston 2024-03-19 09:17:23 -10:00 committed by GitHub
parent 15c0422837
commit 32c64855b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -423,7 +423,10 @@ async def ws_event_stream(
hass,
connection,
msg_id,
last_event_time or start_time,
# Add one microsecond so we are outside the window of
# the last event we got from the database since otherwise
# we could fetch the same event twice
(last_event_time or start_time) + timedelta(microseconds=1),
subscriptions_setup_complete_time,
messages.event_message,
event_processor,

View File

@ -2285,7 +2285,7 @@ async def test_live_stream_with_one_second_commit_interval(
hass.bus.async_fire("mock_event", {"device_id": device.id, "message": "7"})
while len(recieved_rows) != 7:
while len(recieved_rows) < 7:
msg = await asyncio.wait_for(websocket_client.receive_json(), 2.5)
assert msg["id"] == 7
assert msg["type"] == "event"