mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Fix HOMEASSISTANT_STOP unsubscribe in data update coordinator (#145809)
* initial commit * a better approach * Add comment
This commit is contained in:
parent
83af5ec36b
commit
612861061c
@ -138,6 +138,8 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
|||||||
|
|
||||||
async def _on_hass_stop(_: Event) -> None:
|
async def _on_hass_stop(_: Event) -> None:
|
||||||
"""Shutdown coordinator on HomeAssistant stop."""
|
"""Shutdown coordinator on HomeAssistant stop."""
|
||||||
|
# Already cleared on EVENT_HOMEASSISTANT_STOP, via async_fire_internal
|
||||||
|
self._unsub_shutdown = None
|
||||||
await self.async_shutdown()
|
await self.async_shutdown()
|
||||||
|
|
||||||
self._unsub_shutdown = self.hass.bus.async_listen_once(
|
self._unsub_shutdown = self.hass.bus.async_listen_once(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user