Commit e00f6687 by baiquan

refactor(shop): 调整线程池参数和上传逻辑

- 将线程池参数设置移至特定任务类型下
- 暂时注释掉视频上传中的异常处理逻辑
parent fc37c9b9
......@@ -633,14 +633,14 @@ def is_video_corrupted(file_path):
def upload_video_with_multithreading(task):
"""多线程视频上传主函数"""
# 准备视频文件(同原逻辑)
try:
file_path = prepare_video_file(task)
except VideoError:
# 视频时长超过60秒, 使用生成视频
video_info = generate_video(task)
return video_info
except Exception as e:
raise e
# try:
file_path = prepare_video_file(task)
# except VideoError:
# # 视频时长超过60秒, 使用生成视频
# video_info = generate_video(task)
# return video_info
# except Exception as e:
# raise e
# 初始化上传
upload = Upload(task)
upload.file_size = os.path.getsize(file_path)
......
......@@ -227,10 +227,6 @@ async def run(task_type):
if __name__ == '__main__':
# 外层线程池大小
OUTER_MAX_WORKERS = 5
# 内层线程池大小(每个任务)
INNER_MAX_WORKERS = 3
argv = sys.argv
try:
if len(argv) != 2:
......@@ -250,6 +246,10 @@ if __name__ == '__main__':
INNER_MAX_WORKERS = 1
time.sleep(10)
elif task_type == TaskType.DOUDIAN_UPLOAD_IMAGE_AND_VIDEO:
# 外层线程池大小
OUTER_MAX_WORKERS = 5
# 内层线程池大小(每个任务)
INNER_MAX_WORKERS = 3
time.sleep(1)
else:
time.sleep(5)
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