refactor: Increase default task cleanup interval and retention time

This commit is contained in:
leozeli 2026-03-04 10:42:54 +08:00
parent 15da43a1c4
commit 98146bf060

View file

@ -358,16 +358,15 @@ func (al *AgentLoop) Stop() {
// runTaskCleanup periodically cleans up old completed tasks (Phase 2) // runTaskCleanup periodically cleans up old completed tasks (Phase 2)
func (al *AgentLoop) runTaskCleanup(ctx context.Context) { func (al *AgentLoop) runTaskCleanup(ctx context.Context) {
// Get cleanup interval from config, default to 5 minutes
intervalMins := al.cfg.Agents.Defaults.TaskCleanupIntervalMins intervalMins := al.cfg.Agents.Defaults.TaskCleanupIntervalMins
if intervalMins <= 0 { if intervalMins <= 0 {
intervalMins = 5 intervalMins = 30
} }
// Get retention time from config, default to 1 hour // Get retention time from config, default to 24 hour
retentionHours := al.cfg.Agents.Defaults.TaskRetentionHours retentionHours := al.cfg.Agents.Defaults.TaskRetentionHours
if retentionHours <= 0 { if retentionHours <= 0 {
retentionHours = 1 retentionHours = 24
} }
ticker := time.NewTicker(time.Duration(intervalMins) * time.Minute) ticker := time.NewTicker(time.Duration(intervalMins) * time.Minute)