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
Migrate restore_state helper to use registry loading pattern #93773
Conversation
As more entities have started using restore_state over time, it has become a startup bottleneck as each entity being added is creating a task to load restore state data that is already loaded since it is a singleton We now use the same pattern as the registry helpers
Was a refactoring error 🤦 |
Will likely need to adjust some mocks |
It seems like setting |
Missing coverage is existing. Code is only moved that if affected and not changed |
Thanks. Thats the bulk of the startup improvements. Going to work with Mike on the numerous |
Its been a while since I looked at startup performance. The new yellow got me looking at it again since when I migrated my production config to it, I noticed a few integrations failed at startup (and had to retry) because the cpu load got too high during startup.
Proposed change
As more entities have started using restore_state over time, it has become a startup bottleneck as each entity being added is creating tasks (was using a gather) to load restore state data that is already loaded since it is a singleton
We now use the same pattern as the registry helpers
Type of change
Additional information
Checklist
black --fast 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: