修复bug
This commit is contained in:
@@ -203,8 +203,8 @@ def watchLiveForGrowth():
|
||||
def stopScript():
|
||||
body = request.get_json()
|
||||
udid = body.get("udid")
|
||||
ThreadManager.stop(udid)
|
||||
return ResultData(data="").toJson()
|
||||
code, msg = ThreadManager.stop(udid)
|
||||
return ResultData(code=code, data="", msg=msg).toJson()
|
||||
|
||||
|
||||
# 传递主播数据
|
||||
|
||||
@@ -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
|
||||
@@ -198,6 +198,9 @@ class ScriptManager():
|
||||
# 点击搜索按钮
|
||||
ControlUtils.clickSearch(session)
|
||||
|
||||
# 创建udid名称的目录
|
||||
AiUtils.makeUdidDir(udid)
|
||||
|
||||
# 返回上一步
|
||||
def goBack(count):
|
||||
for i in range(count):
|
||||
|
||||
Reference in New Issue
Block a user