Use async_create_task (#15633)

* Use async_create_task

* Fix test
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-07-23 14:05:38 +02:00
1 parent 50b6c5948d
commit ea2ff6aae3
26 files changed
+50 -49

No files matched your search

+2 -2
View File
@@ -167,7 +167,7 @@ def async_setup(hass, config):
def async_handle_core_service(call):
"""Service handler for handling core services."""
if call.service == SERVICE_HOMEASSISTANT_STOP:
hass.async_add_job(hass.async_stop())
hass.async_create_task(hass.async_stop())
return
try:
@@ -183,7 +183,7 @@ def async_setup(hass, config):
return
if call.service == SERVICE_HOMEASSISTANT_RESTART:
hass.async_add_job(hass.async_stop(RESTART_EXIT_CODE))
hass.async_create_task(hass.async_stop(RESTART_EXIT_CODE))
hass.services.async_register(
ha.DOMAIN, SERVICE_HOMEASSISTANT_STOP, async_handle_core_service)