fix(team_process): Clean up stuck processing owners on startup and batch completion
- Add CleanupStuckProcessingOwners database method to reset owners stuck in processing status back to valid state - Call cleanup routine on application startup to recover from previous abnormal exits - Call cleanup routine after batch processing completes to ensure no orphaned processing states remain - Add markOwnerResult calls in processSingleTeam when team invitations are full to properly track owner status - Prevents owners from being permanently stuck in processing state due to unexpected shutdowns or errors
This commit is contained in:
@@ -627,6 +627,15 @@ func (d *DB) CleanupStuckBatchRuns() (int64, error) {
|
||||
return result.RowsAffected()
|
||||
}
|
||||
|
||||
// CleanupStuckProcessingOwners 清理卡住的 processing 状态母号,重置为 valid
|
||||
func (d *DB) CleanupStuckProcessingOwners() (int64, error) {
|
||||
result, err := d.db.Exec(`UPDATE team_owners SET status = 'valid' WHERE status = 'processing'`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return result.RowsAffected()
|
||||
}
|
||||
|
||||
// GetBatchRunStats 获取批次统计
|
||||
func (d *DB) GetBatchRunStats() map[string]interface{} {
|
||||
stats := make(map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user