修bug
This commit is contained in:
@@ -57,7 +57,7 @@ func (r *gormPendingTaskRepository) FindAllPendingTasks(ctx context.Context) ([]
|
||||
var tasks []models.PendingTask
|
||||
// 预加载 Task 以便后续访问 Task.PlanID
|
||||
// 预加载 TaskExecutionLog 以便后续访问 PlanExecutionLogID
|
||||
err := r.db.WithContext(repoCtx).Preload("Task").Preload("TaskExecutionLog").Find(&tasks).Error
|
||||
err := r.db.WithContext(repoCtx).Preload("Tasks").Preload("TaskExecutionLogs").Find(&tasks).Error
|
||||
return tasks, err
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ func (r *gormPendingTaskRepository) ClaimNextAvailableTask(ctx context.Context,
|
||||
return err
|
||||
}
|
||||
|
||||
// 在 Preload("Task") 时,使用 Unscoped() 来忽略 Task 的软删除状态
|
||||
if err := tx.WithContext(repoCtx).Preload("Task", func(db *gorm.DB) *gorm.DB {
|
||||
// 在 Preload("Tasks") 时,使用 Unscoped() 来忽略 Task 的软删除状态
|
||||
if err := tx.WithContext(repoCtx).Preload("Tasks", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Unscoped()
|
||||
}).First(&log, pendingTask.TaskExecutionLogID).Error; err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user