diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-05-31 04:57:17 -0400 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-05-31 16:57:17 +0800 |
commit | bfb44f885468839259bc2ead999953cdd85654e1 (patch) | |
tree | 1b8b404133dad5ad4650d15a0a9acc6207fb916b /models/repo_mirror.go | |
parent | 0f5b399e351786254f48dc1e5ed3419c3153703f (diff) | |
download | gitea-bfb44f885468839259bc2ead999953cdd85654e1.tar.gz gitea-bfb44f885468839259bc2ead999953cdd85654e1.zip |
Fix status table race condition (#1835)
Diffstat (limited to 'models/repo_mirror.go')
-rw-r--r-- | models/repo_mirror.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go index 8a97879253..4588597743 100644 --- a/models/repo_mirror.go +++ b/models/repo_mirror.go @@ -202,10 +202,9 @@ func DeleteMirrorByRepoID(repoID int64) error { // MirrorUpdate checks and updates mirror repositories. func MirrorUpdate() { - if taskStatusTable.IsRunning(mirrorUpdate) { + if !taskStatusTable.StartIfNotRunning(mirrorUpdate) { return } - taskStatusTable.Start(mirrorUpdate) defer taskStatusTable.Stop(mirrorUpdate) log.Trace("Doing: MirrorUpdate") |