feat: add batch processing history and real-time status monitoring for team uploads
This commit is contained in:
@@ -80,6 +80,11 @@ func main() {
|
||||
}
|
||||
fmt.Println()
|
||||
|
||||
// 启动时清理遗留的 running 状态批次(避免多个运行中状态)
|
||||
if affected, err := database.Instance.CleanupStuckBatchRuns(); err == nil && affected > 0 {
|
||||
fmt.Printf("%s[清理]%s 已清理 %d 个遗留的运行中批次记录\n", colorYellow, colorReset, affected)
|
||||
}
|
||||
|
||||
// 启动自动补号检查器(需在前端开启开关才会实际补号)
|
||||
api.StartAutoAddService()
|
||||
|
||||
|
||||
@@ -167,6 +167,13 @@ func HandleTeamProcess(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// 启动新任务前,先清理数据库中遗留的 running 状态批次
|
||||
if database.Instance != nil {
|
||||
if affected, err := database.Instance.CleanupStuckBatchRuns(); err == nil && affected > 0 {
|
||||
logger.Warning(fmt.Sprintf("清理了 %d 个遗留的运行中批次记录", affected), "", "team")
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化状态
|
||||
teamProcessState.Running = true
|
||||
teamProcessState.StartedAt = time.Now()
|
||||
|
||||
Reference in New Issue
Block a user