Add run_immediately to bluetooth listeners (#113659)
This commit is contained in:
parent
1f9c8694a8
commit
5e8265d8a4
2 changed files with 10 additions and 4 deletions
|
@ -166,7 +166,9 @@ async def _async_start_adapter_discovery(
|
|||
"""Shutdown debouncer."""
|
||||
discovery_debouncer.async_shutdown()
|
||||
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer)
|
||||
hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer, run_immediately=True
|
||||
)
|
||||
|
||||
async def _async_call_debouncer(now: datetime.datetime) -> None:
|
||||
"""Call the debouncer at a later time."""
|
||||
|
@ -197,7 +199,9 @@ async def _async_start_adapter_discovery(
|
|||
|
||||
cancel = usb.async_register_scan_request_callback(hass, _async_trigger_discovery)
|
||||
hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_STOP, hass_callback(lambda event: cancel())
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
hass_callback(lambda event: cancel()),
|
||||
run_immediately=True,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -135,9 +135,11 @@ class HomeAssistantBluetoothManager(BluetoothManager):
|
|||
self._bluetooth_adapters, self.storage
|
||||
)
|
||||
self._cancel_logging_listener = self.hass.bus.async_listen(
|
||||
EVENT_LOGGING_CHANGED, self._async_logging_changed
|
||||
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
|
||||
)
|
||||
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()
|
||||
|
|
Loading…
Add table
Reference in a new issue