From 30f6c4f8291c8970f22598760fedb463c19b9630 Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 18 Jul 2023 11:26:40 +0800 Subject: [PATCH] Correct order once the tec_client disconnects to stop watching the client first --- pytec/tec_qt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 0965ddf..8c72bed 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -178,13 +178,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): return await self._on_connection_changed(True) else: - await self.tec_client.disconnect() await self._on_connection_changed(False) + await self.tec_client.disconnect() except (OSError, TimeoutError) as e: logging.error(f"Failed communicating to {ip}:{port}: {e}") - await self.tec_client.disconnect() await self._on_connection_changed(False) + await self.tec_client.disconnect() async def coro_main():