Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Fix the problem that backup time may be negative #405

Merged
merged 5 commits into from
Jul 15, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ func (bc *Client) BackupRanges(
allFilesCollected := make(chan struct{}, 1)
go func() {
init := time.Now()
start, cur := init, init
// nolint:ineffassign
lastBackupStart, currentBackupStart := init, init
for files := range filesCh {
cur, start = start, time.Now()
lastBackupStart, currentBackupStart = currentBackupStart, time.Now()
allFiles = append(allFiles, files...)
summary.CollectSuccessUnit("backup ranges", 1, cur.Sub(start))
summary.CollectSuccessUnit("backup ranges", 1, currentBackupStart.Sub(lastBackupStart))
}
log.Info("Backup Ranges", zap.Duration("take", cur.Sub(init)))
log.Info("Backup Ranges", zap.Duration("take", currentBackupStart.Sub(init)))
allFilesCollected <- struct{}{}
}()

Expand Down