-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Always do thread safety checks when calling async_fire #116055
Conversation
Since almost all core events call async_fire_internal now its worth the performance tradeoff here to check if the thread is correct
a2818d3
to
4a8a6a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a merge conflict.
In a followup I will add the check in async_register and async_unregister and switch them to use _internal since currently they can still unsafely register a service from a thread since the check doesn't happen until the service registered event is fired. It will also give devs a better hint as to where things went wrong |
needs
Proposed change
Since almost all core events call
async_fire_internal
(after #116027) now its worth the performance tradeoff to check if the thread is correct inasync_fire
.See discussion #115390 (comment)
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: