Skip to content

Commit

Permalink
Merge pull request #19 from justinsb/only_do_backup_maintenance_hourly
Browse files Browse the repository at this point in the history
Don't run backup cleanup more often if it fails
  • Loading branch information
k8s-ci-robot authored Dec 27, 2024
2 parents ecdaeff + 890785f commit ba146f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/backupcontroller/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func (m *BackupCleanup) MaybeDoBackupMaintenance(ctx context.Context) error {
return nil
}

// Set the last backup cleanup time before we run the cleanup,
// so that we don't run this again immediately even if the cleanup fails.
m.lastBackupCleanup = now

backupNames, err := m.backupStore.ListBackups()
if err != nil {
return fmt.Errorf("error listing backups: %v", err)
Expand Down Expand Up @@ -183,7 +187,5 @@ func (m *BackupCleanup) MaybeDoBackupMaintenance(ctx context.Context) error {
klog.Infof("Removed %d old backups", removedCount)
}

m.lastBackupCleanup = now

return nil
}

0 comments on commit ba146f5

Please sign in to comment.