Add small speed improvement when unloading Ambient PWS (#28756)

pull/28763/head
Aaron Bach 2019-11-13 14:25:49 -07:00 committed by GitHub
parent 8789da36be
commit c27b94c0e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,5 @@
"""Support for Ambient Weather Station Service."""
import asyncio
import logging
from aioambient import Client
@ -297,8 +298,12 @@ async def async_unload_entry(hass, config_entry):
ambient = hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id)
hass.async_create_task(ambient.ws_disconnect())
for component in ("binary_sensor", "sensor"):
await hass.config_entries.async_forward_entry_unload(config_entry, component)
tasks = [
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in ("binary_sensor", "sensor")
]
await asyncio.gather(*tasks)
return True