修复bug

This commit is contained in:
zw
2025-08-14 14:46:52 +08:00
parent f3fe7a661f
commit 6747de733a
3 changed files with 19 additions and 11 deletions

View File

@@ -17,12 +17,17 @@ class ThreadManager():
@classmethod
def stop(cls, udid):
print(cls.threads)
info = cls.threads[udid]
if info:
info["stopEvent"].set() # 停止线程
info["thread"].join(timeout=3) # 等待线程退出
del cls.threads[udid]
LogManager.info("停止线程成功", udid)
else:
LogManager.info("无此线程,无需关闭", udid)
try:
info = cls.threads[udid]
if info:
info["stopEvent"].set() # 停止线程
info["thread"].join(timeout=3) # 等待线程退出
del cls.threads[udid]
LogManager.info("停止线程成功", udid)
return 200, "停止线程成功 " + udid
else:
LogManager.info("无此线程,无需关闭", udid)
return 1001, "无此线程,无需关闭 " + udid
except KeyError as e:
LogManager.info("无此线程,无需关闭", udid)
return 1001, "停止脚本失败 " + udid