diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-10-11 22:51:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 14:51:20 +0000 |
commit | 1d155a43adfb97e486c1378eef682b1912132005 (patch) | |
tree | 04cf499cf6d66618d9e880f54d016794d4624f88 /services | |
parent | fb74fe99d65c05f0f711666058f4d46b46f37c08 (diff) | |
download | gitea-1d155a43adfb97e486c1378eef682b1912132005.tar.gz gitea-1d155a43adfb97e486c1378eef682b1912132005.zip |
Fix data-race bug when accessing task.LastRun (#27584)
Diffstat (limited to 'services')
-rw-r--r-- | services/cron/cron.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/services/cron/cron.go b/services/cron/cron.go index 63db75ab3b..3c5737e371 100644 --- a/services/cron/cron.go +++ b/services/cron/cron.go @@ -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, |