diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-06-10 03:52:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-09 15:52:55 -0400 |
commit | 5fef041079d8524537e24e8afc5d2b8c2579600c (patch) | |
tree | 8dac314922735bcd7252fab7c6e8ffaa62f00f00 /services | |
parent | fb3ffeb18df6bb94bb3f69348a93398b05259174 (diff) | |
download | gitea-5fef041079d8524537e24e8afc5d2b8c2579600c.tar.gz gitea-5fef041079d8524537e24e8afc5d2b8c2579600c.zip |
Remove unnecessary goroutine (#16080)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'services')
-rw-r--r-- | services/pull/check.go | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/services/pull/check.go b/services/pull/check.go index 3ec76de5e8..9db1654cfb 100644 --- a/services/pull/check.go +++ b/services/pull/check.go @@ -28,21 +28,19 @@ var prQueue queue.UniqueQueue // AddToTaskQueue adds itself to pull request test task queue. func AddToTaskQueue(pr *models.PullRequest) { - go func() { - err := prQueue.PushFunc(strconv.FormatInt(pr.ID, 10), func() error { - pr.Status = models.PullRequestStatusChecking - err := pr.UpdateColsIfNotMerged("status") - if err != nil { - log.Error("AddToTaskQueue.UpdateCols[%d].(add to queue): %v", pr.ID, err) - } else { - log.Trace("Adding PR ID: %d to the test pull requests queue", pr.ID) - } - return err - }) - if err != nil && err != queue.ErrAlreadyInQueue { - log.Error("Error adding prID %d to the test pull requests queue: %v", pr.ID, err) + err := prQueue.PushFunc(strconv.FormatInt(pr.ID, 10), func() error { + pr.Status = models.PullRequestStatusChecking + err := pr.UpdateColsIfNotMerged("status") + if err != nil { + log.Error("AddToTaskQueue.UpdateCols[%d].(add to queue): %v", pr.ID, err) + } else { + log.Trace("Adding PR ID: %d to the test pull requests queue", pr.ID) } - }() + return err + }) + if err != nil && err != queue.ErrAlreadyInQueue { + log.Error("Error adding prID %d to the test pull requests queue: %v", pr.ID, err) + } } // checkAndUpdateStatus checks if pull request is possible to leaving checking status, |