summaryrefslogtreecommitdiffstats
path: root/services/task/migrate.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/task/migrate.go')
-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