system/ui: fix WiFi manager shutdown task errors (#35204)

fix WiFi manager shutdown task errors
pull/35225/head
Dean Lee 1 week ago committed by GitHub
parent f1c0109c89
commit 84e9b75983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      system/ui/lib/wifi_manager.py

@ -115,7 +115,7 @@ class WifiManager:
except asyncio.CancelledError: except asyncio.CancelledError:
pass pass
if self.bus: if self.bus:
await self.bus.disconnect() self.bus.disconnect()
async def request_scan(self) -> None: async def request_scan(self) -> None:
try: try:
@ -634,8 +634,10 @@ class WifiManagerWrapper:
def shutdown(self) -> None: def shutdown(self) -> None:
if self._running: if self._running:
if self._manager is not None: if self._manager is not None and self._loop:
self._run_coroutine(self._manager.shutdown()) shutdown_future = asyncio.run_coroutine_threadsafe(self._manager.shutdown(), self._loop)
shutdown_future.result(timeout=3.0)
if self._loop and self._loop.is_running(): if self._loop and self._loop.is_running():
self._loop.call_soon_threadsafe(self._loop.stop) self._loop.call_soon_threadsafe(self._loop.stop)
if self._thread and self._thread.is_alive(): if self._thread and self._thread.is_alive():

Loading…
Cancel
Save