1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Replace executor with async_add_job (#7658)

* Remove executor

* Lint

* Lint

* Fix tests
This commit is contained in:
Paulus Schoutsen
2017-05-26 08:28:07 -07:00
committed by GitHub
parent 9e9705d6b2
commit f43db3c615
46 changed files with 196 additions and 248 deletions

View File

@@ -83,7 +83,7 @@ def _async_process_requirements(hass: core.HomeAssistant, name: str,
with (yield from pip_lock):
for req in requirements:
ret = yield from hass.loop.run_in_executor(None, pip_install, req)
ret = yield from hass.async_add_job(pip_install, req)
if not ret:
_LOGGER.error("Not initializing %s because could not install "
"dependency %s", name, req)
@@ -184,8 +184,8 @@ def _async_setup_component(hass: core.HomeAssistant,
if async_comp:
result = yield from component.async_setup(hass, processed_config)
else:
result = yield from hass.loop.run_in_executor(
None, component.setup, hass, processed_config)
result = yield from hass.async_add_job(
component.setup, hass, processed_config)
except Exception: # pylint: disable=broad-except
_LOGGER.exception("Error during setup of component %s", domain)
async_notify_setup_error(hass, domain, True)