-
-
Notifications
You must be signed in to change notification settings - Fork 32k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for eager tasks #111425
Add support for eager tasks #111425
Conversation
python 3.12 supports eager tasks reading: https://docs.python.org/3/library/asyncio-task.html#eager-task-factory python/cpython#97696 There are lots of places were we are unlikely to suspend, but we might suspend so creating a task makes sense
We have races in Not so bad. I'm going to take the entity changes out as they can be sorted out in a future PR Let's start with websocket tasks instead |
The web socket latency reduction is awesome. The second group now arrives 1ms later than the first group instead of 30ms later |
Assuming the CI passes, I'll pull everything out that actually changes something to an eager task, add coverage, and do follow ups PRs to convert specific areas starting with the websocket |
This would probably help service calls a lot |
seems to work ok |
websocket latency reduction can sometimes even deliver in the same millis |
functional testing on 3.11 looks good. I know its going away soon, but fallback still needs to work for a bit |
Proposed change
python 3.12 supports eager tasks
There are lots of places were we are unlikely to suspend, but we might suspend so we don't replace with an loop of awaits. In this case creating an eager task makes sense instead. eager start support will be great for reducing latency of icons and translation loading via websocket since we have to create a task in the very rare event they aren't loaded yet.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: