Fix lingering timers in bluetooth (part 2) (#91674)

This commit is contained in:
epenet 2023-04-20 11:04:07 +02:00 committed by GitHub
parent d8c9ed3a64
commit bb2461ea93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -169,3 +169,9 @@ class ActiveBluetoothDataUpdateCoordinator(
# possible after a device comes online or back in range, if a poll is due
if self.needs_poll(service_info):
self.hass.async_create_task(self._debounced_poll.async_call())
@callback
def _async_stop(self) -> None:
"""Cancel debouncer and stop the callbacks."""
self._debounced_poll.async_cancel()
super()._async_stop()

View File

@ -158,3 +158,9 @@ class ActiveBluetoothProcessorCoordinator(
# possible after a device comes online or back in range, if a poll is due
if self.needs_poll(service_info):
self.hass.async_create_task(self._debounced_poll.async_call())
@callback
def _async_stop(self) -> None:
"""Cancel debouncer and stop the callbacks."""
self._debounced_poll.async_cancel()
super()._async_stop()