-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Make database access in the eventloop raise an exception #71547
Make database access in the eventloop raise an exception #71547
Conversation
- In 2022.4 we added a warning that the database executor should be used for database access which revealed places where the database was accessed in the eventloop - If the database is accessed in the default executor, it will continue to report the access, but proceed as normal.
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
This comment was marked as abuse.
This comment was marked as abuse.
sqlalchemy 1.4 now has asyncio support but its still maturing. We might switch to it once they release 2.0 but all the existing code would have to change since everything has to be awaited. https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html |
codecov failure is not related to this PR |
Breaking change
Accessing the database does blocking I/O and needs to be done
in the executor since it causes instability by blocking Home Assistant's
event loop (which means Home Assistant cannot do anything until the
database call finishes)
In 2022.4 we added a warning that the database executor should
be used for database access which revealed places where the
database was accessed in the eventloop
If the database is accessed in the default executor, it will continue
to report the access, but proceed as normal.
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
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: