Browse Source

Fix data-race bug when accessing task.LastRun (#27584)

pull/27590/head
wxiaoguang 2 years ago committed by GitHub
parent
commit
1d155a43ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      services/cron/cron.go

3
services/cron/cron.go

@ -107,12 +107,11 @@ func ListTasks() TaskTable { @@ -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,

Loading…
Cancel
Save