Remove not needed call_soon (#2606)

This commit is contained in:
Pascal Vizeli 2021-02-22 14:41:44 +01:00 committed by GitHub
parent 6b7d437b00
commit 2de175e181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,15 +153,12 @@ class HomeAssistantWebSocket(CoreSysAttributes):
def supervisor_update_event(self, key: str, data: Optional[Dict[str, Any]] = None): def supervisor_update_event(self, key: str, data: Optional[Dict[str, Any]] = None):
"""Send a supervisor/event command.""" """Send a supervisor/event command."""
if self.sys_core.state not in CLOSING_STATES: if self.sys_core.state in CLOSING_STATES:
self.sys_loop.call_soon( return
self.sys_loop.create_task, self.sys_create_task(self.async_supervisor_update_event(key, data))
self.async_supervisor_update_event(key, data),
)
def send_command(self, message: Dict[str, Any]): def send_command(self, message: Dict[str, Any]):
"""Send a supervisor/event command.""" """Send a supervisor/event command."""
if self.sys_core.state not in CLOSING_STATES: if self.sys_core.state in CLOSING_STATES:
self.sys_loop.call_soon( return
self.sys_loop.create_task, self.async_send_command(message) self.sys_create_task(self.async_send_command(message))
)