This is an automated email from the ASF dual-hosted git repository. abeizn pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit fb4d976c658fb5b5ca032095f08e492fd1f386d8 Author: Nddtfjiang <[email protected]> AuthorDate: Fri Sep 30 01:37:20 2022 +0000 fix: fix-3256 Add GetTaskById. Nddtfjiang <[email protected]> --- services/task.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/task.go b/services/task.go index 43b77cf4..cec571fe 100644 --- a/services/task.go +++ b/services/task.go @@ -279,8 +279,15 @@ func runTaskStandalone(parentLog core.Logger, taskId uint64) errors.Error { return err } +func getTaskById(taskId uint64) *RunningTaskData { + runningTasks.mu.Lock() + defer runningTasks.mu.Unlock() + + return runningTasks.tasks[taskId] +} + func updateTaskProgress(taskId uint64, progress chan core.RunningProgress) { - data := runningTasks.tasks[taskId] + data := getTaskById(taskId) if data == nil { return }
