Commit facd415a by baiquan

fix:优化任务类型输入处理

- 增加异常处理,提高代码健壮性
- 将任务类型转换为整数,确保类型正确
parent 46f8e0be
...@@ -217,13 +217,15 @@ if __name__ == '__main__': ...@@ -217,13 +217,15 @@ if __name__ == '__main__':
# 内层线程池大小(每个任务) # 内层线程池大小(每个任务)
INNER_MAX_WORKERS = 3 INNER_MAX_WORKERS = 3
argv = sys.argv argv = sys.argv
print(argv) try:
if len(argv) != 2: if len(argv) != 2:
raise Exception
else:
task_type = argv[1]
task_type = int(task_type)
except:
logger.error("请传入任务类型(1为店铺登录,2为上传图片与视频)") logger.error("请传入任务类型(1为店铺登录,2为上传图片与视频)")
sys.exit(0) sys.exit(0)
else:
task_type = argv[1]
while True: while True:
asyncio.run(run(task_type)) asyncio.run(run(task_type))
time.sleep(10) time.sleep(10)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment