diff --git a/internal/orchestrator/taskbackup.go b/internal/orchestrator/taskbackup.go index d4752554..3af931c9 100644 --- a/internal/orchestrator/taskbackup.go +++ b/internal/orchestrator/taskbackup.go @@ -116,10 +116,6 @@ func backupHelper(ctx context.Context, t Task, orchestrator *Orchestrator, plan lastSent := time.Now() // debounce progress updates, these can endup being very frequent. var lastFiles []string summary, err := repo.Backup(ctx, plan, func(entry *restic.BackupProgressEntry) { - if time.Since(lastSent) < 250*time.Millisecond { - return - } - lastSent = time.Now() if entry.MessageType == "status" { // prevents flickering output when a status entry omits the CurrentFiles property. Largely cosmetic. @@ -130,9 +126,6 @@ func backupHelper(ctx context.Context, t Task, orchestrator *Orchestrator, plan } backupOp.OperationBackup.LastStatus = protoutil.BackupProgressEntryToProto(entry) - if err := orchestrator.OpLog.Update(op); err != nil { - zap.S().Errorf("failed to update oplog with progress for backup: %v", err) - } } else if entry.MessageType == "error" { zap.S().Warnf("backup error: %v", entry.Error) backupError, err := protoutil.BackupProgressEntryToBackupError(entry) @@ -148,6 +141,15 @@ func backupHelper(ctx context.Context, t Task, orchestrator *Orchestrator, plan } else if entry.MessageType != "summary" { zap.S().Warnf("unexpected message type %q in backup progress entry", entry.MessageType) } + + if time.Since(lastSent) < 500*time.Millisecond { + return + } + lastSent = time.Now() + + if err := orchestrator.OpLog.Update(op); err != nil { + zap.S().Errorf("failed to update oplog with progress for backup: %v", err) + } }) vars := hook.HookVars{