diff --git a/homeassistant/components/websocket_api/http.py b/homeassistant/components/websocket_api/http.py index 7671d0ceaef..310247709f8 100644 --- a/homeassistant/components/websocket_api/http.py +++ b/homeassistant/components/websocket_api/http.py @@ -172,7 +172,7 @@ class WebSocketHandler: ( "%s: Client unable to keep up with pending messages. Reached %s pending" " messages. The system's load is too high or an integration is" - " misbehaving. Last message was: %s" + " misbehaving; Last message was: %s" ), self.description, MAX_PENDING_MSG, @@ -209,11 +209,12 @@ class WebSocketHandler: ( "%s: Client unable to keep up with pending messages. Stayed over %s for %s" " seconds. The system's load is too high or an integration is" - " misbehaving" + " misbehaving; Last message was: %s" ), self.description, PENDING_MSG_PEAK, PENDING_MSG_PEAK_TIME, + self._message_queue[-1], ) self._cancel() diff --git a/tests/components/websocket_api/test_http.py b/tests/components/websocket_api/test_http.py index 8e47e7fca2e..7c008f7515b 100644 --- a/tests/components/websocket_api/test_http.py +++ b/tests/components/websocket_api/test_http.py @@ -70,7 +70,7 @@ async def test_pending_msg_peak( # Fill the queue past the allowed peak for _ in range(10): - instance._send_message({}) + instance._send_message({"overload": "message"}) async_fire_time_changed( hass, utcnow() + timedelta(seconds=const.PENDING_MSG_PEAK_TIME + 1) @@ -79,7 +79,8 @@ async def test_pending_msg_peak( msg = await websocket_client.receive() assert msg.type == WSMsgType.close assert "Client unable to keep up with pending messages" in caplog.text - assert "Stayed over 5 for 5 seconds" + assert "Stayed over 5 for 5 seconds" in caplog.text + assert "overload" in caplog.text async def test_pending_msg_peak_recovery(