From 5bb4ab688e896d384cc520791c46bb2cecac1051 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sat, 16 May 2026 20:11:02 +0900 Subject: [PATCH] feat: capture sigint events in server loops --- dzgui/model/servers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dzgui/model/servers.py b/dzgui/model/servers.py index ec00391..3c3ba8a 100644 --- a/dzgui/model/servers.py +++ b/dzgui/model/servers.py @@ -57,7 +57,7 @@ class ServerModelManager: def load(self) -> None: """ - There may be cases where you want to instantiate this class without dumping servers, + Load is not called on init. There may be cases where you want to instantiate this class without dumping servers, e.g., adding saved servers from another tab """ @@ -134,6 +134,8 @@ class ServerModelManager: futures = [executor.submit(Servers.test_ip, i, port, event) for i in ports] for future in as_completed(futures): try: + if self.controller.get_exit_event().is_set(): + return res = future.result(timeout=LAN_TIMEOUT) if res is None: continue @@ -169,8 +171,10 @@ class ServerModelManager: for ip in ips ] for future in as_completed(futures): + # TODO: wrap except + if self.controller.get_exit_event().is_set(): + return res = future.result(timeout=API_TIMEOUT) - self.thread_man.increment_dialog() # NOTE: failing entries are culled if res is None: