From 8b4c80ab174b4f454a992ff998b6cb1041faf63d Mon Sep 17 00:00:00 2001 From: James Munson Date: Thu, 17 Aug 2023 19:09:28 -0600 Subject: [PATCH] Fix 6481 - unbounded growth in BackupList from failure retries. Signed-off-by: James Munson --- pkg/sync/rpc/list.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/sync/rpc/list.go b/pkg/sync/rpc/list.go index f2555fca7..8951b102e 100644 --- a/pkg/sync/rpc/list.go +++ b/pkg/sync/rpc/list.go @@ -111,23 +111,23 @@ func (*BackupList) remove(b []*BackupInfo, index int) ([]*BackupInfo, error) { } // Refresh deletes all the old completed backups from the front. Old backups are the completed backups -// that are created before the number we choose to retain. +// (finished or error) that were created before the number we choose to retain. func (b *BackupList) refresh() error { b.Lock() defer b.Unlock() for state, limit := range retainBackupStateCounts { - var index, completed int + var index, count int for index = len(b.infos) - 1; index >= 0; index-- { if b.infos[index].backupStatus.State == state { - if completed == limit { + if count == limit { break } - completed++ + count++ } } - if completed == limit { + if count == limit { // Remove all the older completed backups in the range backupList[0:index] for ; index >= 0; index-- { if b.infos[index].backupStatus.State == state {