Skip to content

Commit

Permalink
Fix data-race bug when accessing task.LastRun (go-gitea#27584)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored and GiteaBot committed Oct 11, 2023
1 parent 7ec7c73 commit 228b81a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions services/cron/cron.go
Expand Up @@ -107,12 +107,11 @@ func ListTasks() TaskTable {
prev = e.PreviousRun()
}

task.lock.Lock()
// If the manual run is after the cron run, use that instead.
if prev.Before(task.LastRun) {
prev = task.LastRun
}

task.lock.Lock()
tTable = append(tTable, &TaskTableRow{
Name: task.Name,
Spec: spec,
Expand Down

0 comments on commit 228b81a

Please sign in to comment.