From da14acb3b6ad7430aae980fa5aca87ff2b79271e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 20 Oct 2022 09:35:09 -0500 Subject: [PATCH] Speed up restart when bluetooth adapter is in a failed state (#80640) --- homeassistant/components/bluetooth/scanner.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/bluetooth/scanner.py b/homeassistant/components/bluetooth/scanner.py index 642bf13f7cd..8d4adfe9a3d 100644 --- a/homeassistant/components/bluetooth/scanner.py +++ b/homeassistant/components/bluetooth/scanner.py @@ -385,15 +385,11 @@ class HaScanner(BaseHaScanner): async def async_stop(self) -> None: """Stop bluetooth scanner.""" - async with self._start_stop_lock: - await self._async_stop() - - async def _async_stop(self) -> None: - """Cancel watchdog and bluetooth discovery under the lock.""" if self._cancel_watchdog: self._cancel_watchdog() self._cancel_watchdog = None - await self._async_stop_scanner() + async with self._start_stop_lock: + await self._async_stop_scanner() async def _async_stop_scanner(self) -> None: """Stop bluetooth discovery under the lock."""