mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 06:32:53 +01:00
feat: capture sigint events in server loops
This commit is contained in:
1 parent
73d66ab5e7
commit
5bb4ab688e
1 file changed
+6
-2
@@ -57,7 +57,7 @@ class ServerModelManager:
|
|||||||
|
|
||||||
def load(self) -> None:
|
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
|
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]
|
futures = [executor.submit(Servers.test_ip, i, port, event) for i in ports]
|
||||||
for future in as_completed(futures):
|
for future in as_completed(futures):
|
||||||
try:
|
try:
|
||||||
|
if self.controller.get_exit_event().is_set():
|
||||||
|
return
|
||||||
res = future.result(timeout=LAN_TIMEOUT)
|
res = future.result(timeout=LAN_TIMEOUT)
|
||||||
if res is None:
|
if res is None:
|
||||||
continue
|
continue
|
||||||
@@ -169,8 +171,10 @@ class ServerModelManager:
|
|||||||
for ip in ips
|
for ip in ips
|
||||||
]
|
]
|
||||||
for future in as_completed(futures):
|
for future in as_completed(futures):
|
||||||
|
# TODO: wrap except
|
||||||
|
if self.controller.get_exit_event().is_set():
|
||||||
|
return
|
||||||
res = future.result(timeout=API_TIMEOUT)
|
res = future.result(timeout=API_TIMEOUT)
|
||||||
|
|
||||||
self.thread_man.increment_dialog()
|
self.thread_man.increment_dialog()
|
||||||
# NOTE: failing entries are culled
|
# NOTE: failing entries are culled
|
||||||
if res is None:
|
if res is None:
|
||||||
|
|||||||
Reference in new issue
Block a user