Skip to content

Commit

Permalink
[core] fixed race condition for getTasks in roster.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Tichák authored and teo committed Apr 29, 2024
1 parent 14adf0a commit 90ef93f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/task/roster.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func (m *roster) getTasks() Tasks {
m.mu.RLock()
defer m.mu.RUnlock()

return m.tasks
tasks:= make(Tasks, len(m.tasks))
copy(tasks, m.tasks)

return tasks
}

func (m *roster) updateTasks(tasks Tasks) {
Expand Down

0 comments on commit 90ef93f

Please sign in to comment.