Run SSDP discovery in parallel (#24299)

pull/24305/head
Paulus Schoutsen 2019-06-04 11:04:02 -07:00
parent d17f27b65c
commit 185af1b42a
1 changed files with 6 additions and 3 deletions

View File

@ -86,13 +86,16 @@ class Scanner:
if not to_load: if not to_load:
return return
for entry, info, domains in to_load: tasks = []
for entry, info, domains in to_load:
for domain in domains: for domain in domains:
_LOGGER.debug("Discovered %s at %s", domain, entry.location) _LOGGER.debug("Discovered %s at %s", domain, entry.location)
await self.hass.config_entries.flow.async_init( tasks.append(self.hass.config_entries.flow.async_init(
domain, context={'source': DOMAIN}, data=info domain, context={'source': DOMAIN}, data=info
) ))
await asyncio.wait(tasks)
async def _process_entry(self, entry): async def _process_entry(self, entry):
"""Process a single entry.""" """Process a single entry."""