Commit Graph
31 Commits
Author SHA1 Message Date
J. Nick KostonandGitHub 671c4e1eab Reduce log spam from unauthenticated websocket connections (#151388) 2025-09-01 10:35:22 +02:00
Marc MuellerandGitHub 5843e63878 Add contextmanager to reset logger after set_level call in tests (#143295) 2025-04-20 02:13:01 +02:00
0abe57edaa Avoid checking if debug logging is enabled on every WebSocket message (#142258)
Co-authored-by: epenet <[email protected]>
2025-04-04 22:28:55 +02:00
J. Nick KostonandGitHub fd9f002e9f Increase websocket_api allowed peak time to 10s (#141680)
* Increase websocket_api allowed peak time to 10s

fixes #141624

During integration reload or startup, we can end up sending a message for
each entity being created for integrations that create them from an external
source (ie MQTT) because the messages come in one at a time. This can overload
the loop and/or client for more than 5s. While we have done significant work
to optimize for this path, we are at the limit at what we can expect clients
to be able to process in the time window, so increase the time window.

* adjust test
2025-03-28 20:32:00 +01:00
J. Nick KostonandGitHub 53c486ccd1 Bump aiohttp to 3.11.0b3 (#129363) 2024-11-06 15:59:31 -06:00
J. Nick KostonandGitHub 108a54a4a8 Handle WebSocket client disconnect during prepare (#124173) 2024-08-19 15:28:05 -05:00
J. Nick KostonandGitHub 6bdc5be433 Bump aiohttp to 3.10.0b1 (#122409) 2024-07-23 12:10:22 -05:00
J. Nick KostonandGitHub 79bc179ce8 Improve websocket message coalescing to handle thundering herds better (#118268)
* Increase websocket peak messages to match max expected entities

During startup the websocket would frequently disconnect if more than
4096 entities were added back to back. Some MQTT setups will have more
than 10000 entities. Match the websocket peak value to the max expected
entities

* coalesce more

* delay more if the backlog gets large

* wait to send if the queue is building rapidly

* tweak

* tweak for chrome since it works great in firefox but chrome cannot handle it

* Revert "tweak for chrome since it works great in firefox but chrome cannot handle it"

This reverts commit 439e2d76b1.

* adjust for chrome

* lower number

* remove code

* fixes

* fast path for bytes

* compact

* adjust test since we see the close right away now on overload

* simplify check

* reduce loop

* tweak

* handle ready right away
2024-05-28 23:14:06 -04:00
J. Nick KostonandGitHub 137514edb7 Bump aiohttp to 3.9.4 (#110730)
* Bump aiohttp to 3.9.4

This is rc0 for now but will be updated when the full release it out

* cleanup cruft

* regen

* fix tests (these changes are fine)

* chunk size is too small to read since boundry is now enforced

* chunk size is too small to read since boundry is now enforced
2024-04-11 11:58:56 -10:00
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
2024-03-26 00:02:16 +01:00
SidandGitHub 82a60fe8ad Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Marc MuellerandGitHub 32f3f46542 Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc MuellerandGitHub 8b0c9d3d18 Use builtin TimeoutError [t-z] (#109683) 2024-02-05 12:20:36 +01:00
825fed8319 Bump aiohttp to 3.9.3 (#109025)
Co-authored-by: Joost Lekkerkerker <[email protected]>
2024-01-29 23:15:18 +01:00
Franck NijhofandGitHub 868a5f377f Ruff: isort don't split imports based on trailing comma (#98162) 2023-08-10 14:27:03 +02:00
J. Nick KostonandGitHub 3f18f515e7 Improve websocket api coverage and typing (#94891) 2023-06-20 15:21:24 +01:00
1206f2c1da Fix memory leaks in websocket api (#94780)
Co-authored-by: Martin Hjelmare <[email protected]>
2023-06-19 18:27:22 -05:00
J. Nick KostonandGitHub 99265a983a Speed up reconnects by caching state serialize (#93050) 2023-05-16 02:33:12 -05:00
J. Nick KostonandGitHub 2848f8648d Log last message when websocket reaches peak limit (#93038)
When we hit the absolute limit, we would log the last messages as
it was key to finding out the source. We now do the same when
we hit the peak limit
2023-05-14 12:22:19 -04:00
J. Nick KostonandGitHub 8711735ec0 Improve websocket throughput and reduce latency (#92967) 2023-05-13 00:13:57 +09:00
Paulus SchoutsenandGitHub 0ca6723378 Allow passing binary to the WS connection (#89882)
* Allow passing binary to the WS connection

* Expand test coverage

* Test non-existing handler

* Allow signaling end of stream using empty payloads

* Store handlers in a list

* Handle binary handlers raising exceptions
2023-03-22 08:36:36 -04:00
ecf87ae979 Improve performance of websocket_api dispatch (#88496)
Co-authored-by: Paulus Schoutsen <[email protected]>
2023-02-20 19:51:34 +01:00
epenetandGitHub aa50096a31 Add type hints to integration tests (part 24) (#88307) 2023-02-17 16:34:53 +01:00
J. Nick KostonandGitHub 0f4b17755e Improve logging and handling when websocket gets behind (#86854)
fixes undefined
2023-01-29 10:49:27 -10:00
Paulus SchoutsenandGitHub a42547c0e5 Allow get_states to recover (#67146) 2022-02-23 21:15:48 -08:00
Paulus SchoutsenandGitHub 6d0da631bf Handle prepare timeout in websocket API (#55989) 2021-10-08 22:12:06 -07:00
7fe3c472e9 Improve bad JSON data reporting (#47932)
* Improve bad data reporting

* Fix tests

Co-authored-by: Erik <[email protected]>
2021-03-15 10:41:25 +01:00
Franck NijhofandGitHub 65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Paulus SchoutsenandGitHub ec47216388 Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Paulus SchoutsenandGitHub d93c09327a Report unserializable data in websocket (#34072)
* Report unserializable data in websocket

* Fix tests

* log types too
2020-04-13 23:46:41 -07:00
Paulus SchoutsenandGitHub bea354b82a Allow WS queue to temporarily peak (#34175)
* Allow WS queue to temporarily peak

* Remove unused code
2020-04-13 18:50:36 -07:00