8000 Fix subscribe_bootstrap_integrations to send events by bdraco · Pull Request #48754 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix subscribe_bootstrap_integrations to send events #48754

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

Merged
merged 3 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ async def _async_set_up_integrations(
hass.data[DATA_SETUP_STARTED] = {}
setup_time = hass.data[DATA_SETUP_TIME] = {}

log_task = asyncio.create_task(_async_watch_pending_setups(hass))
watch_task = asyncio.create_task(_async_watch_pending_setups(hass))

domains_to_setup = _get_domains(hass, config)

Expand Down Expand Up @@ -555,7 +555,9 @@ async def _async_set_up_integrations(
except asyncio.TimeoutError:
_LOGGER.warning("Setup timed out for stage 2 - moving forward")

log_task.cancel()
watch_task.cancel()
async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, {})

_LOGGER.debug(
"Integration setup times: %s",
{
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/websocket_api/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def handle_subscribe_bootstrap_integrations(hass, connection, msg):
@callback
def forward_bootstrap_integrations(message):
"""Forward bootstrap integrations to websocket."""
connection.send_message(messages.result_message(msg["id"], message))
connection.send_message(messages.event_message(msg["id"], message))

connection.subscriptions[msg["id"]] = async_dispatcher_connect(
hass, SIGNAL_BOOTSTRAP_INTEGRATONS, forward_bootstrap_integrations
Expand Down
5 changes: 2 additions & 3 deletions tests/components/websocket_api/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,8 @@ async def test_subscribe_unsubscribe_bootstrap_integrations(
async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, message)
msg = await websocket_client.receive_json()
assert msg["id"] == 7
assert msg["success"] is True
assert msg["type"] == "result"
assert msg["result"] == message
assert msg["type"] == "event"
assert msg["event"] == message


async def test_integration_setup_info(hass, websocket_client, hass_admin_user):
Expand Down
0