Switch dispatcher to use async_run_hass_job (#74514)

* Switch dispatcher to use async_run_hass_job

- Since we already wrap all the callbacks in catch_log_exception
  we can use async_run_hass_job here

- The overhead of wrapping the call in a call_soon, queuing it
  and running it later usually exceeds the overhead of running
  the job itself

* fix size change during iteration

* fix out of order send

* fix missing mocking in unifi test

* Fix Legrand Home+ Control updating entities before the coordinator update had finished

* stray debug
This commit is contained in:
J. Nick Koston 2022-07-07 10:39:05 -05:00 committed by GitHub
parent 323d4a0e1b
commit 1dd9e705f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 17 deletions

View file

@ -86,8 +86,8 @@ async def websocket_supervisor_event(
hass: HomeAssistant, connection: ActiveConnection, msg: dict
):
"""Publish events from the Supervisor."""
async_dispatcher_send(hass, EVENT_SUPERVISOR_EVENT, msg[ATTR_DATA])
connection.send_result(msg[WS_ID])
async_dispatcher_send(hass, EVENT_SUPERVISOR_EVENT, msg[ATTR_DATA])
@websocket_api.websocket_command(