Refactor zeroconf setup to be async (#39955)

* Refactor zeroconf setup to be async

Most of the setup was calling back to async because
we were setting up listeners.  Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.

In testing this cut the setup time in half
or better.

* partial revert to after_deps
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-09-13 18:06:19 -05:00
1 parent 00acb180d6
commit 7b016063ca
10 files changed
+84 -91

No files matched your search

+3 -1
View File
@@ -37,7 +37,9 @@ def netdisco_mock():
async def mock_discovery(hass, discoveries, config=BASE_CONFIG):
"""Mock discoveries."""
with patch("homeassistant.components.zeroconf.async_get_instance"):
with patch("homeassistant.components.zeroconf.async_get_instance"), patch(
"homeassistant.components.zeroconf.async_setup", return_value=True
):
assert await async_setup_component(hass, "discovery", config)
await hass.async_block_till_done()
await hass.async_start()