Add RemoveOutdatedServices
This commit is contained in:
@@ -47,7 +47,19 @@ func runCifFullDownload(cfg *helpers.Configuration) error {
|
||||
log.Warn("CIF Data updated, but metadata write failed")
|
||||
}
|
||||
|
||||
// Set parsed to nil to encourage garbage collection
|
||||
parsed = nil
|
||||
|
||||
// Clear out of date schedules
|
||||
cutoff := time.Now().Add(-time.Hour * 24 * 7)
|
||||
log.Debug("Attempting to remove outdated services", zap.Time("scheduleEnd before", cutoff))
|
||||
count, err := dbAccess.RemoveOutdatedServices(cutoff)
|
||||
if err != nil {
|
||||
log.Warn("Out of date services not removed", zap.Error(err))
|
||||
} else {
|
||||
log.Info("Out of date services removed", zap.Int64("removal count", count))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user