Deprecate calling async_listen and async_listen_once with run_immediately (#115169)

This commit is contained in:
J. Nick Koston 2024-04-08 10:07:54 -10:00 committed by GitHub
parent 5ef42078a3
commit ca5ed274cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 126 additions and 243 deletions

View file

@ -166,9 +166,7 @@ async def _async_start_adapter_discovery(
"""Shutdown debouncer."""
discovery_debouncer.async_shutdown()
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer)
async def _async_call_debouncer(now: datetime.datetime) -> None:
"""Call the debouncer at a later time."""
@ -201,7 +199,6 @@ async def _async_start_adapter_discovery(
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP,
hass_callback(lambda event: cancel()),
run_immediately=True,
)

View file

@ -135,11 +135,9 @@ class HomeAssistantBluetoothManager(BluetoothManager):
self._bluetooth_adapters, self.storage
)
self._cancel_logging_listener = self.hass.bus.async_listen(
EVENT_LOGGING_CHANGED, self._async_logging_changed, run_immediately=True
)
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self.async_stop, run_immediately=True
EVENT_LOGGING_CHANGED, self._async_logging_changed
)
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
seen: set[str] = set()
for address, service_info in itertools.chain(
self._connectable_history.items(), self._all_history.items()

View file

@ -274,7 +274,6 @@ async def async_setup(hass: HomeAssistant) -> None:
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP,
_async_save_processor_data_at_stop,
run_immediately=True,
)