Skip to content

Commit 1d155a4

Browse files
authored
Fix data-race bug when accessing task.LastRun (#27584)
1 parent fb74fe9 commit 1d155a4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

services/cron/cron.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ func ListTasks() TaskTable {
107107
prev = e.PreviousRun()
108108
}
109109

110+
task.lock.Lock()
110111
// If the manual run is after the cron run, use that instead.
111112
if prev.Before(task.LastRun) {
112113
prev = task.LastRun
113114
}
114-
115-
task.lock.Lock()
116115
tTable = append(tTable, &TaskTableRow{
117116
Name: task.Name,
118117
Spec: spec,

0 commit comments

Comments
 (0)