Run functions from ssdp listeners immediately (#113634)

This commit is contained in:
J. Nick Koston 2024-03-16 13:52:01 -10:00 committed by GitHub
parent cede6af496
commit 513da0f71e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -392,7 +392,9 @@ class Scanner:
await self._async_start_ssdp_listeners()
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self.async_stop, run_immediately=True
)
self._cancel_scan = async_track_time_interval(
self.hass, self.async_scan, SCAN_INTERVAL, name="SSDP scanner"
)
@ -752,9 +754,13 @@ class Server:
async def async_start(self) -> None:
"""Start the server."""
bus = self.hass.bus
bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
bus.async_listen_once(
EVENT_HOMEASSISTANT_STARTED, self._async_start_upnp_servers
EVENT_HOMEASSISTANT_STOP, self.async_stop, run_immediately=True
)
bus.async_listen_once(
EVENT_HOMEASSISTANT_STARTED,
self._async_start_upnp_servers,
run_immediately=True,
)
async def _async_get_instance_udn(self) -> str: