Simply remove all backups up to the last to when using filesystem
backend
This commit is contained in:
+2
-4
@@ -121,10 +121,8 @@ function cleanupBackups(callback) {
|
||||
backups.getPaged(1, 1000, function (error, result) {
|
||||
if (error) return callback(error);
|
||||
|
||||
var TIME_OFFSET = 1000 * 60 * 60 * 24 * 2; // 2 days = 2 backups
|
||||
var TIME_THRESHOLD = Date.now() - TIME_OFFSET;
|
||||
|
||||
var toCleanup = result.filter(function (backup) { return backup.creationTime.getTime() <= TIME_THRESHOLD; });
|
||||
// sort with latest backups first in the array and slice 2
|
||||
var toCleanup = result.sort(function (a, b) { return b.creationTime.getTime() - a.creationTime.getTime(); }).slice(2);
|
||||
|
||||
debug('cleanupBackups: about to clean: ', toCleanup);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user