From d710af6669654f27f02b69d7ef1ba563e7d58a90 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 21 Nov 2021 23:41:00 +0800 Subject: Remove NewSession method from db.Engine interface (#17577) * Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample --- models/task.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'models/task.go') diff --git a/models/task.go b/models/task.go index c8af1a4967..9bff00cd8c 100644 --- a/models/task.go +++ b/models/task.go @@ -253,14 +253,6 @@ func FinishMigrateTask(task *Task) error { } task.PayloadContent = string(confBytes) - sess := db.NewSession(db.DefaultContext) - defer sess.Close() - if err := sess.Begin(); err != nil { - return err - } - if _, err := sess.ID(task.ID).Cols("status", "end_time", "payload_content").Update(task); err != nil { - return err - } - - return sess.Commit() + _, err = db.GetEngine(db.DefaultContext).ID(task.ID).Cols("status", "end_time", "payload_content").Update(task) + return err } -- cgit v1.2.3