fix: 数据库迁移、同步保存时定时任务未清除问题

This commit is contained in:
meilin.huang
2026-01-21 12:22:54 +08:00
parent f0de65b7ce
commit 4641e448d2
4 changed files with 16 additions and 9 deletions

View File

@@ -71,7 +71,13 @@ func (app *dataSyncAppImpl) Save(ctx context.Context, taskEntity *entity.DataSyn
taskEntity.TaskKey = uuid.New().String()
err = app.Insert(ctx, taskEntity)
} else {
taskEntity.TaskKey = ""
if taskEntity.TaskKey == "" {
task, err := app.GetById(taskEntity.Id)
if err != nil {
return errorx.NewBiz("db sync task not found")
}
taskEntity.TaskKey = task.TaskKey
}
err = app.UpdateById(ctx, taskEntity)
}
if err != nil {