From 39478aa52cd85b3d343b1a4a8374dc06bc52cfd1 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Mon, 14 Dec 2020 15:04:53 +0000 Subject: [PATCH] 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 --- docs/prune-simulator/prune-simulator.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/prune-simulator/prune-simulator.js b/docs/prune-simulator/prune-simulator.js index 37d97e2c..7d792383 100644 --- a/docs/prune-simulator/prune-simulator.js +++ b/docs/prune-simulator/prune-simulator.js @@ -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; }