From 847e73ca2be7cb0b0df2eef425f4adedda20a874 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期日, 08 十月 2023 11:16:01 +0800 Subject: [PATCH] 多个新任务只能第一个可以开始 --- api/v1/task.go | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/api/v1/task.go b/api/v1/task.go index 2e2e8ea..4cf4808 100644 --- a/api/v1/task.go +++ b/api/v1/task.go @@ -111,8 +111,12 @@ return taskResponse.Tasks[i].Channel < taskResponse.Tasks[i].Channel }) + nowTs := time.Now().Unix() + + flagMap := make(map[int32]struct{}, 0) + for _, task := range taskResponse.Tasks { - if !service.TaskFlagGet(task.Channel) { + if _, ok := flagMap[task.Channel]; !ok && !service.TaskFlagGet(task.Channel) && task.Procedure.StartTime <= nowTs { task.CanStarted = true } } -- Gitblit v1.8.0