Skip to content

Commit 13438c9

Browse files
committed
Merge branch 'master' into electra-support
2 parents e740f67 + 67bd416 commit 13438c9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/coordinator/scheduler/task_state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ func (ts *TaskScheduler) newTaskState(options *types.TaskOptions, parentState *t
8080
}
8181

8282
// create task state
83+
ts.taskStateMutex.Lock()
84+
defer ts.taskStateMutex.Unlock()
85+
8386
taskIdx := ts.taskCount
8487
taskState := &taskState{
8588
index: taskIdx,
@@ -110,16 +113,13 @@ func (ts *TaskScheduler) newTaskState(options *types.TaskOptions, parentState *t
110113

111114
ts.taskCount++
112115

113-
// create internal execution state
114-
ts.taskStateMutex.Lock()
115116
ts.taskStateMap[taskIdx] = taskState
116117

117118
if isCleanupTask {
118119
ts.allCleanupTasks = append(ts.allCleanupTasks, taskIdx)
119120
} else {
120121
ts.allTasks = append(ts.allTasks, taskIdx)
121122
}
122-
ts.taskStateMutex.Unlock()
123123

124124
return taskState, nil
125125
}

0 commit comments

Comments
 (0)