调整任务进度跟踪器, 改为从数据库获取执行进度:

修bug
This commit is contained in:
2025-09-23 17:28:33 +08:00
parent 557a0d5d3e
commit eda5c8dedb

View File

@@ -243,8 +243,9 @@ func (s *Scheduler) processTask(claimedLog *models.TaskExecutionLog) {
return return
} }
// 如果此计划执行中已没有其他“等待中”或“进行中”的任务,则认为计划已完成 // 如果此计划执行中,未完成的任务只剩下当前这一个(因为当前任务的状态此时在数据库中仍为 'started'
if incompleteCount == 0 { // 则认为整个计划已完成。
if incompleteCount == 1 {
s.logger.Infof("计划执行 %d 的所有任务已完成,开始处理计划完成逻辑...", claimedLog.PlanExecutionLogID) s.logger.Infof("计划执行 %d 的所有任务已完成,开始处理计划完成逻辑...", claimedLog.PlanExecutionLogID)
// 通过 PlanExecutionLog 反查正确的顶层 PlanID // 通过 PlanExecutionLog 反查正确的顶层 PlanID