Skip to content

Commit 90ef93f

Browse files
justonedev1teo
authored andcommitted
[core] fixed race condition for getTasks in roster.go
1 parent 14adf0a commit 90ef93f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

core/task/roster.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ func (m *roster) getTasks() Tasks {
9696
m.mu.RLock()
9797
defer m.mu.RUnlock()
9898

99-
return m.tasks
99+
tasks:= make(Tasks, len(m.tasks))
100+
copy(tasks, m.tasks)
101+
102+
return tasks
100103
}
101104

102105
func (m *roster) updateTasks(tasks Tasks) {

0 commit comments

Comments
 (0)