Browse Source

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

Backport #27584 by @wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
tags/v1.21.0-rc2
Giteabot 8 months ago
parent
commit
844ab9a441
No account linked to committer's email address
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      services/cron/cron.go

+ 1
- 2
services/cron/cron.go View File

@@ -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