Fix lingering timer in samsungtv (#91450)

This commit is contained in:
epenet 2023-04-16 08:24:04 +02:00 committed by GitHub
parent dc03a5c81e
commit bdb55a4262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,9 +166,9 @@ class DebouncedEntryReloader:
await self._debounced_reload.async_call() await self._debounced_reload.async_call()
@callback @callback
def async_cancel(self) -> None: def async_shutdown(self) -> None:
"""Cancel any pending reload.""" """Cancel any pending reload."""
self._debounced_reload.async_cancel() self._debounced_reload.async_shutdown()
async def _async_reload_entry(self) -> None: async def _async_reload_entry(self) -> None:
"""Reload entry.""" """Reload entry."""
@ -228,7 +228,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# will be a race where the config flow will see the entry # will be a race where the config flow will see the entry
# as not loaded and may reload it # as not loaded and may reload it
debounced_reloader = DebouncedEntryReloader(hass, entry) debounced_reloader = DebouncedEntryReloader(hass, entry)
entry.async_on_unload(debounced_reloader.async_cancel) entry.async_on_unload(debounced_reloader.async_shutdown)
entry.async_on_unload(entry.add_update_listener(debounced_reloader.async_call)) entry.async_on_unload(entry.add_update_listener(debounced_reloader.async_call))
hass.data[DOMAIN][entry.entry_id] = bridge hass.data[DOMAIN][entry.entry_id] = bridge