prune sim: correctly keep track of already included backups

This needs to happen in a separate loop, because some time intervals are not
subsets of others, i.e. weeks and months. Previously, with a daily backup
schedule, having:
* a backup on Sun, 06 Dec 2020 kept by keep-daily
* a backup on Sun, 29 Nov 2020 kept by keep-weekly
would lead to the backup on Mon, 30 Nov 2020 to be selected for keep-monthly,
because the iteration did not yet reach the backup on Sun, 29 Nov 2020 that
would mark November as being covered.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2020-12-14 15:04:53 +00:00 committed by Thomas Lamprecht
parent 6a99b930c4
commit 39478aa52c
1 changed files with 9 additions and 8 deletions

View File

@ -480,18 +480,19 @@ Ext.onReady(function() {
let finished = false;
backups.forEach(function(backup) {
let mark = backup.mark;
if (mark && mark === 'keep') {
let id = idFunc(backup);
alreadyIncluded[id] = true;
}
});
backups.forEach(function(backup) {
let mark = backup.mark;
let id = idFunc(backup);
if (finished || alreadyIncluded[id]) {
return;
}
if (mark) {
if (mark === 'keep') {
alreadyIncluded[id] = true;
}
if (finished || alreadyIncluded[id] || mark) {
return;
}