Ensure we keep at least one backup on cleanup

If for some reason backups fail for longer than the retention time
we should at least keep the latest around
This commit is contained in:
Johannes Zellner
2017-04-24 12:01:50 +02:00
parent ca7f80414e
commit 410420e9d5
+3
View File
@@ -437,6 +437,9 @@ function cleanup(callback) {
getPaged(1, 1000, function (error, result) {
if (error) return callback(error);
// ensure we keep at least the last backup to ensure we have one if backup creation failed for some reason
result = result.slice(1);
var now = new Date();
async.eachSeries(result, function iterator(backup, iteratorDone) {