aboutsummaryrefslogtreecommitdiffstats
path: root/services/task/migrate.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/task/migrate.go')
-rw-r--r--services/task/migrate.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/task/migrate.go b/services/task/migrate.go
index b74e024ba6..475fa7a61b 100644
--- a/services/task/migrate.go
+++ b/services/task/migrate.go
@@ -48,10 +48,11 @@ func runMigrateTask(ctx context.Context, t *admin_model.Task) (err error) {
log.Critical("PANIC during runMigrateTask[%d] by DoerID[%d] to RepoID[%d] for OwnerID[%d]: %v\nStacktrace: %v", t.ID, t.DoerID, t.RepoID, t.OwnerID, e, log.Stack(2))
}
// fixme: Because ctx is canceled here, so the db.DefaultContext is needed.
+ ctx := db.DefaultContext
if err == nil {
- err = admin_model.FinishMigrateTask(db.DefaultContext, t)
+ err = admin_model.FinishMigrateTask(ctx, t)
if err == nil {
- notify_service.MigrateRepository(db.DefaultContext, t.Doer, t.Owner, t.Repo)
+ notify_service.MigrateRepository(ctx, t.Doer, t.Owner, t.Repo)
return
}
@@ -63,8 +64,7 @@ func runMigrateTask(ctx context.Context, t *admin_model.Task) (err error) {
t.EndTime = timeutil.TimeStampNow()
t.Status = structs.TaskStatusFailed
t.Message = err.Error()
- // fixme: Because ctx is canceled here, so the db.DefaultContext is needed.
- if err := t.UpdateCols(db.DefaultContext, "status", "message", "end_time"); err != nil {
+ if err := t.UpdateCols(ctx, "status", "message", "end_time"); err != nil {
log.Error("Task UpdateCols failed: %v", err)
}