-
-
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race in notify setup #76954
Fix race in notify setup #76954
Conversation
The dispatcher must be connected before we can add to `hass.config.components` to ensure signals are missed
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
I think there is still a race here with yaml ones I think we need to separate
|
#76919 also possibly solved |
I'm pretty sure this will fix it, but I'm not comfortable merging it without adding some more tests since we are obviously lacking ones to catch this case in the first place. That might have to be tomorrow though |
Need to step away for a bit since I've been sitting for too long. I'll write tests when I get back. |
hass.async_create_task(
discovery.async_load_platform(
hass,
Platform.NOTIFY,
DOMAIN,
hass.data[DOMAIN][entry.entry_id],
hass.data[DOMAIN],
)
)
hass.async_create_task(
discovery.async_load_platform(
hass,
Platform.NOTIFY,
DOMAIN,
hass.data[DOMAIN][entry.entry_id],
hass.data[DOMAIN],
)
) |
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.
This is an improvement as it could race. Not sure if it is the issue though. I think the forwarding not real hass_config
to discovery is the real cause.
This may be true except that |
Please see below. I may be missing something but it doesn't look like
slack
anddiscord
passhass_config
which may be the actual root cause here (although I think there is still a race).It would be helpful if someone could validate that or tell me I'm reading it wrong 馃槃
details: #76954 (comment)
Proposed change
The discovery dispatcher must be connected before we can add
to
hass.config.components
to ensure signals arenot missed since the legacy setup await can return control
to the event loop before it gets connected.
Fixes #76564
Fixes #76402
Fixes #76343
Fixes #76919
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: