summaryrefslogtreecommitdiffstats
path: root/services/task
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-11-30 20:06:32 +0000
committerGitHub <noreply@github.com>2021-11-30 20:06:32 +0000
commit01087e9eef21ff5ea1cebbb1e84933954671fdf2 (patch)
treeae618785a3bd46e012096683e2fd2309f87c571d /services/task
parentd894c90b703ce215e2319ae2e2bf95989f77805d (diff)
downloadgitea-01087e9eef21ff5ea1cebbb1e84933954671fdf2.tar.gz
gitea-01087e9eef21ff5ea1cebbb1e84933954671fdf2.zip
Make Requests Processes and create process hierarchy. Associate OpenRepository with context. (#17125)
This PR registers requests with the process manager and manages hierarchy within the processes. Git repos are then associated with a context, (usually the request's context) - with sub commands using this context as their base context. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services/task')
-rw-r--r--services/task/migrate.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/services/task/migrate.go b/services/task/migrate.go
index 46ea80b002..8e9f6115bc 100644
--- a/services/task/migrate.go
+++ b/services/task/migrate.go
@@ -5,7 +5,6 @@
package task
import (
- "context"
"errors"
"fmt"
"strings"
@@ -99,11 +98,9 @@ func runMigrateTask(t *models.Task) (err error) {
opts.MigrateToRepoID = t.RepoID
- ctx, cancel := context.WithCancel(graceful.GetManager().ShutdownContext())
- defer cancel()
pm := process.GetManager()
- pid := pm.Add(fmt.Sprintf("MigrateTask: %s/%s", t.Owner.Name, opts.RepoName), cancel)
- defer pm.Remove(pid)
+ ctx, _, finished := pm.AddContext(graceful.GetManager().ShutdownContext(), fmt.Sprintf("MigrateTask: %s/%s", t.Owner.Name, opts.RepoName))
+ defer finished()
t.StartTime = timeutil.TimeStampNow()
t.Status = structs.TaskStatusRunning